]> git.lizzy.rs Git - rust.git/commitdiff
Make clippy work with parallel rustc
authorJohn Kåre Alsaker <john.kare.alsaker@gmail.com>
Thu, 3 Jan 2019 17:17:43 +0000 (18:17 +0100)
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>
Thu, 3 Jan 2019 18:18:06 +0000 (19:18 +0100)
clippy_lints/src/consts.rs
clippy_lints/src/enum_variants.rs
clippy_lints/src/utils/mod.rs

index a1fe13e4962aa9fd70434ccd59f1a54c7d09d98e..8369f4b4470725cc7adec2a5bff4f759afd48fa3 100644 (file)
 use rustc::ty::subst::{Subst, Substs};
 use rustc::ty::{self, Instance, Ty, TyCtxt};
 use rustc::{bug, span_bug};
+use rustc_data_structures::sync::Lrc;
 use std::cmp::Ordering::{self, Equal};
 use std::cmp::PartialOrd;
 use std::convert::TryInto;
 use std::hash::{Hash, Hasher};
-use std::rc::Rc;
 use syntax::ast::{FloatTy, LitKind};
 use syntax::ptr::P;
 
@@ -31,7 +31,7 @@ pub enum Constant {
     /// a String "abc"
     Str(String),
     /// a Binary String b"abc"
-    Binary(Rc<Vec<u8>>),
+    Binary(Lrc<Vec<u8>>),
     /// a single char 'a'
     Char(char),
     /// an integer's bit representation
@@ -156,7 +156,7 @@ pub fn lit_to_constant<'tcx>(lit: &LitKind, ty: Ty<'tcx>) -> Constant {
     match *lit {
         LitKind::Str(ref is, _) => Constant::Str(is.to_string()),
         LitKind::Byte(b) => Constant::Int(u128::from(b)),
-        LitKind::ByteStr(ref s) => Constant::Binary(Rc::clone(s)),
+        LitKind::ByteStr(ref s) => Constant::Binary(Lrc::clone(s)),
         LitKind::Char(c) => Constant::Char(c),
         LitKind::Int(n, _) => Constant::Int(n),
         LitKind::Float(ref is, _) | LitKind::FloatUnsuffixed(ref is) => match ty.sty {
index c5d7094dcc1a37c44a36c525b3076f4866befca2..5466baae88606548f14d15ac50f89eb226cd0543 100644 (file)
@@ -15,7 +15,7 @@
 use rustc::{declare_tool_lint, lint_array};
 use syntax::ast::*;
 use syntax::source_map::Span;
-use syntax::symbol::LocalInternedString;
+use syntax::symbol::{InternedString, LocalInternedString};
 
 /// **What it does:** Detects enumeration variants that are prefixed or suffixed
 /// by the same characters.
 }
 
 pub struct EnumVariantNames {
-    modules: Vec<(LocalInternedString, String)>,
+    modules: Vec<(InternedString, String)>,
     threshold: u64,
 }
 
@@ -308,6 +308,6 @@ fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
             };
             check_variant(cx, self.threshold, def, &item_name, item_name_chars, item.span, lint);
         }
-        self.modules.push((item_name, item_camel));
+        self.modules.push((item_name.as_interned_str(), item_camel));
     }
 }
index 647bae1ae6bd5742a4e0f55607f0240315870285..edf8fb8d033eead5edeb02b6ea389a8443a37567 100644 (file)
     subst::Kind,
     Binder, Ty, TyCtxt,
 };
+use rustc_data_structures::sync::Lrc;
 use rustc_errors::{Applicability, CodeSuggestion, Substitution, SubstitutionPart};
 use std::borrow::Cow;
 use std::env;
 use std::mem;
-use std::rc::Rc;
 use std::str::FromStr;
 use syntax::ast::{self, LitKind};
 use syntax::attr;
@@ -223,7 +223,7 @@ pub fn path_to_def(cx: &LateContext<'_, '_>, path: &[&str]) -> Option<def::Def>
                 None => return None,
             };
 
-            for item in mem::replace(&mut items, Rc::new(vec![])).iter() {
+            for item in mem::replace(&mut items, Lrc::new(vec![])).iter() {
                 if item.ident.name == *segment {
                     if path_it.peek().is_none() {
                         return Some(item.def);