From 3af68f831a27b024a95c80cd2f9a9fe7f25eeb18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Thu, 3 Jan 2019 18:17:43 +0100 Subject: [PATCH] Make clippy work with parallel rustc --- clippy_lints/src/consts.rs | 6 +++--- clippy_lints/src/enum_variants.rs | 6 +++--- clippy_lints/src/utils/mod.rs | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/clippy_lints/src/consts.rs b/clippy_lints/src/consts.rs index a1fe13e4962..8369f4b4470 100644 --- a/clippy_lints/src/consts.rs +++ b/clippy_lints/src/consts.rs @@ -17,11 +17,11 @@ use rustc::lint::LateContext; 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>), + Binary(Lrc>), /// 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 { diff --git a/clippy_lints/src/enum_variants.rs b/clippy_lints/src/enum_variants.rs index c5d7094dcc1..5466baae886 100644 --- a/clippy_lints/src/enum_variants.rs +++ b/clippy_lints/src/enum_variants.rs @@ -15,7 +15,7 @@ use rustc::lint::{EarlyContext, EarlyLintPass, Lint, LintArray, LintPass}; 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. @@ -111,7 +111,7 @@ declare_clippy_lint! { } pub struct EnumVariantNames { - modules: Vec<(LocalInternedString, String)>, + modules: Vec<(InternedString, String)>, threshold: u64, } @@ -308,6 +308,6 @@ impl EarlyLintPass for EnumVariantNames { }; 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)); } } diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index 647bae1ae6b..edf8fb8d033 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -25,11 +25,11 @@ use rustc::ty::{ 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 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);