Make clippy work with parallel rustc
This commit is contained in:
@@ -17,11 +17,11 @@ use rustc::lint::LateContext;
|
|||||||
use rustc::ty::subst::{Subst, Substs};
|
use rustc::ty::subst::{Subst, Substs};
|
||||||
use rustc::ty::{self, Instance, Ty, TyCtxt};
|
use rustc::ty::{self, Instance, Ty, TyCtxt};
|
||||||
use rustc::{bug, span_bug};
|
use rustc::{bug, span_bug};
|
||||||
|
use rustc_data_structures::sync::Lrc;
|
||||||
use std::cmp::Ordering::{self, Equal};
|
use std::cmp::Ordering::{self, Equal};
|
||||||
use std::cmp::PartialOrd;
|
use std::cmp::PartialOrd;
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
use std::hash::{Hash, Hasher};
|
use std::hash::{Hash, Hasher};
|
||||||
use std::rc::Rc;
|
|
||||||
use syntax::ast::{FloatTy, LitKind};
|
use syntax::ast::{FloatTy, LitKind};
|
||||||
use syntax::ptr::P;
|
use syntax::ptr::P;
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ pub enum Constant {
|
|||||||
/// a String "abc"
|
/// a String "abc"
|
||||||
Str(String),
|
Str(String),
|
||||||
/// a Binary String b"abc"
|
/// a Binary String b"abc"
|
||||||
Binary(Rc<Vec<u8>>),
|
Binary(Lrc<Vec<u8>>),
|
||||||
/// a single char 'a'
|
/// a single char 'a'
|
||||||
Char(char),
|
Char(char),
|
||||||
/// an integer's bit representation
|
/// an integer's bit representation
|
||||||
@@ -156,7 +156,7 @@ pub fn lit_to_constant<'tcx>(lit: &LitKind, ty: Ty<'tcx>) -> Constant {
|
|||||||
match *lit {
|
match *lit {
|
||||||
LitKind::Str(ref is, _) => Constant::Str(is.to_string()),
|
LitKind::Str(ref is, _) => Constant::Str(is.to_string()),
|
||||||
LitKind::Byte(b) => Constant::Int(u128::from(b)),
|
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::Char(c) => Constant::Char(c),
|
||||||
LitKind::Int(n, _) => Constant::Int(n),
|
LitKind::Int(n, _) => Constant::Int(n),
|
||||||
LitKind::Float(ref is, _) | LitKind::FloatUnsuffixed(ref is) => match ty.sty {
|
LitKind::Float(ref is, _) | LitKind::FloatUnsuffixed(ref is) => match ty.sty {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ use rustc::lint::{EarlyContext, EarlyLintPass, Lint, LintArray, LintPass};
|
|||||||
use rustc::{declare_tool_lint, lint_array};
|
use rustc::{declare_tool_lint, lint_array};
|
||||||
use syntax::ast::*;
|
use syntax::ast::*;
|
||||||
use syntax::source_map::Span;
|
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
|
/// **What it does:** Detects enumeration variants that are prefixed or suffixed
|
||||||
/// by the same characters.
|
/// by the same characters.
|
||||||
@@ -111,7 +111,7 @@ declare_clippy_lint! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub struct EnumVariantNames {
|
pub struct EnumVariantNames {
|
||||||
modules: Vec<(LocalInternedString, String)>,
|
modules: Vec<(InternedString, String)>,
|
||||||
threshold: u64,
|
threshold: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,6 +308,6 @@ impl EarlyLintPass for EnumVariantNames {
|
|||||||
};
|
};
|
||||||
check_variant(cx, self.threshold, def, &item_name, item_name_chars, item.span, lint);
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,11 +25,11 @@ use rustc::ty::{
|
|||||||
subst::Kind,
|
subst::Kind,
|
||||||
Binder, Ty, TyCtxt,
|
Binder, Ty, TyCtxt,
|
||||||
};
|
};
|
||||||
|
use rustc_data_structures::sync::Lrc;
|
||||||
use rustc_errors::{Applicability, CodeSuggestion, Substitution, SubstitutionPart};
|
use rustc_errors::{Applicability, CodeSuggestion, Substitution, SubstitutionPart};
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::rc::Rc;
|
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use syntax::ast::{self, LitKind};
|
use syntax::ast::{self, LitKind};
|
||||||
use syntax::attr;
|
use syntax::attr;
|
||||||
@@ -223,7 +223,7 @@ pub fn path_to_def(cx: &LateContext<'_, '_>, path: &[&str]) -> Option<def::Def>
|
|||||||
None => return None,
|
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 item.ident.name == *segment {
|
||||||
if path_it.peek().is_none() {
|
if path_it.peek().is_none() {
|
||||||
return Some(item.def);
|
return Some(item.def);
|
||||||
|
|||||||
Reference in New Issue
Block a user