mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
Make clippy work with parallel rustc
This commit is contained in:
parent
baec524fac
commit
3af68f831a
@ -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<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 {
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
@ -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<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);
|
||||
|
Loading…
Reference in New Issue
Block a user