mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
Update rust-clippy to rustc 1.9.0-nightly (d5a91e695 2016-03-26)
move cfg, infer, traits and ty from middle to top-level move middle::subst into middle::ty track the extern-crate def-id rather than path (rustc ab9b844)
This commit is contained in:
parent
f51293c399
commit
aa819b7748
24 changed files with 43 additions and 38 deletions
|
@ -31,7 +31,7 @@ the lint will end up to be a nested series of matches and ifs,
|
|||
[like so](https://github.com/Manishearth/rust-clippy/blob/de5ccdfab68a5e37689f3c950ed1532ba9d652a0/src/misc.rs#L34).
|
||||
|
||||
T-middle issues can be more involved and require verifying types. The
|
||||
[`middle::ty`](http://manishearth.github.io/rust-internals-docs/rustc/middle/ty) module contains a
|
||||
[`ty`](http://manishearth.github.io/rust-internals-docs/rustc/middle/ty) module contains a
|
||||
lot of methods that are useful, though one of the most useful would be `expr_ty` (gives the type of
|
||||
an AST expression). `match_def_path()` in Clippy's `utils` module can also be useful.
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use rustc::lint::*;
|
||||
use rustc::middle::const_eval::EvalHint::ExprTypeChecked;
|
||||
use rustc::middle::const_eval::{eval_const_expr_partial, ConstVal};
|
||||
use rustc::middle::ty::TyArray;
|
||||
use rustc::ty::TyArray;
|
||||
use rustc_front::hir::*;
|
||||
use rustc_const_eval::ConstInt;
|
||||
use syntax::ast::RangeLimits;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use rustc::lint::*;
|
||||
use rustc::middle::ty;
|
||||
use rustc::ty;
|
||||
use rustc_front::hir::*;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::hash_map::Entry;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! calculate cyclomatic complexity and warn about overly complex functions
|
||||
|
||||
use rustc::lint::*;
|
||||
use rustc::middle::cfg::CFG;
|
||||
use rustc::middle::ty;
|
||||
use rustc::cfg::CFG;
|
||||
use rustc::ty;
|
||||
use rustc_front::hir::*;
|
||||
use rustc_front::intravisit::{Visitor, walk_expr};
|
||||
use syntax::ast::Attribute;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use rustc::lint::*;
|
||||
use rustc::middle::subst::Subst;
|
||||
use rustc::middle::ty::TypeVariants;
|
||||
use rustc::middle::ty::fast_reject::simplify_type;
|
||||
use rustc::middle::ty;
|
||||
use rustc::ty::subst::Subst;
|
||||
use rustc::ty::TypeVariants;
|
||||
use rustc::ty::fast_reject::simplify_type;
|
||||
use rustc::ty;
|
||||
use rustc_front::hir::*;
|
||||
use syntax::ast::{Attribute, MetaItemKind};
|
||||
use syntax::codemap::Span;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use rustc::lint::*;
|
||||
use rustc::middle::ty;
|
||||
use rustc::ty;
|
||||
use rustc_front::hir::*;
|
||||
use syntax::codemap::Span;
|
||||
use utils::DROP_PATH;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use rustc::front::map::Node::NodeItem;
|
||||
use rustc::front::map::definitions::DefPathData;
|
||||
use rustc::lint::{LateLintPass, LintPass, LateContext, LintArray, LintContext};
|
||||
use rustc::middle::ty::TyEnum;
|
||||
use rustc::ty::TyEnum;
|
||||
use rustc_front::hir::*;
|
||||
use syntax::ast::NodeId;
|
||||
use syntax::codemap::Span;
|
||||
|
@ -51,8 +51,9 @@ impl EnumGlobUse {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if let Some(dp) = cx.sess().cstore.def_path(def.def_id()).last() {
|
||||
if let DefPathData::Type(_) = dp.data {
|
||||
let dp = cx.sess().cstore.relative_def_path(def.def_id());
|
||||
if let Some(dpa) = dp.data.last() {
|
||||
if let DefPathData::TypeNs(_) = dpa.data {
|
||||
if let TyEnum(..) = cx.sess().cstore.item_type(&cx.tcx, def.def_id()).ty.sty {
|
||||
span_lint(cx, ENUM_GLOB_USE, item.span, "don't use glob imports for enum variants");
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use rustc::front::map::Node::{NodeExpr, NodeStmt};
|
||||
use rustc::lint::*;
|
||||
use rustc::middle::expr_use_visitor::*;
|
||||
use rustc::middle::infer;
|
||||
use rustc::infer;
|
||||
use rustc::middle::mem_categorization::{cmt, Categorization};
|
||||
use rustc::middle::traits::ProjectionMode;
|
||||
use rustc::middle::ty::adjustment::AutoAdjustment;
|
||||
use rustc::middle::ty;
|
||||
use rustc::traits::ProjectionMode;
|
||||
use rustc::ty::adjustment::AutoAdjustment;
|
||||
use rustc::ty;
|
||||
use rustc::util::nodemap::NodeSet;
|
||||
use rustc_front::hir::*;
|
||||
use rustc_front::intravisit as visit;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use rustc::lint::*;
|
||||
use rustc::middle::ty;
|
||||
use rustc::ty;
|
||||
use rustc_front::hir::*;
|
||||
use utils::{snippet_opt, span_lint_and_then, is_adjusted};
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use rustc::front::map::Node::NodeItem;
|
||||
use rustc::lint::*;
|
||||
use rustc::middle::ty::TypeVariants;
|
||||
use rustc::ty::TypeVariants;
|
||||
use rustc_front::hir::*;
|
||||
use syntax::ast::LitKind;
|
||||
use utils::{DISPLAY_FMT_METHOD_PATH, FMT_ARGUMENTS_NEWV1_PATH, STRING_PATH};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use rustc::lint::*;
|
||||
use rustc::middle::def_id::DefId;
|
||||
use rustc::middle::ty::{self, MethodTraitItemId, ImplOrTraitItemId};
|
||||
use rustc::ty::{self, MethodTraitItemId, ImplOrTraitItemId};
|
||||
use rustc_front::hir::*;
|
||||
use syntax::ast::{Lit, LitKind, Name};
|
||||
use syntax::codemap::{Span, Spanned};
|
||||
|
|
|
@ -5,7 +5,7 @@ use rustc::middle::const_eval::EvalHint::ExprTypeChecked;
|
|||
use rustc::middle::const_eval::{ConstVal, eval_const_expr_partial};
|
||||
use rustc::middle::def::Def;
|
||||
use rustc::middle::region::CodeExtent;
|
||||
use rustc::middle::ty;
|
||||
use rustc::ty;
|
||||
use rustc_front::hir::*;
|
||||
use rustc_front::intravisit::{Visitor, walk_expr, walk_block, walk_decl};
|
||||
use std::borrow::Cow;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use rustc::lint::*;
|
||||
use rustc::middle::const_eval::EvalHint::ExprTypeChecked;
|
||||
use rustc::middle::const_eval::{eval_const_expr_partial, ConstVal};
|
||||
use rustc::middle::ty;
|
||||
use rustc::ty;
|
||||
use rustc_front::hir::*;
|
||||
use rustc_const_eval::ConstInt;
|
||||
use std::cmp::Ordering;
|
||||
|
|
|
@ -2,8 +2,8 @@ use rustc::lint::*;
|
|||
use rustc::middle::const_eval::EvalHint::ExprTypeChecked;
|
||||
use rustc::middle::const_eval::{ConstVal, eval_const_expr_partial};
|
||||
use rustc::middle::cstore::CrateStore;
|
||||
use rustc::middle::subst::{Subst, TypeSpace};
|
||||
use rustc::middle::ty;
|
||||
use rustc::ty::subst::{Subst, TypeSpace};
|
||||
use rustc::ty;
|
||||
use rustc_front::hir::*;
|
||||
use std::borrow::Cow;
|
||||
use std::fmt;
|
||||
|
|
|
@ -3,7 +3,7 @@ use rustc::lint::*;
|
|||
use rustc::middle::const_eval::ConstVal::Float;
|
||||
use rustc::middle::const_eval::EvalHint::ExprTypeChecked;
|
||||
use rustc::middle::const_eval::eval_const_expr_partial;
|
||||
use rustc::middle::ty;
|
||||
use rustc::ty;
|
||||
use rustc_front::hir::*;
|
||||
use rustc_front::intravisit::FnKind;
|
||||
use rustc_front::util::{is_comparison_binop, binop_to_string};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use rustc::lint::*;
|
||||
use rustc::middle::ty::{TypeAndMut, TyRef};
|
||||
use rustc::ty::{TypeAndMut, TyRef};
|
||||
use rustc_front::hir::*;
|
||||
use utils::{in_external_macro, span_lint};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use rustc::lint::*;
|
||||
use rustc::middle::ty::{TypeAndMut, TypeVariants, MethodCall, TyS};
|
||||
use rustc::ty::{TypeAndMut, TypeVariants, MethodCall, TyS};
|
||||
use rustc_front::hir::*;
|
||||
use syntax::ptr::P;
|
||||
use utils::span_lint;
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
//! This lint is **warn** by default
|
||||
|
||||
use rustc::lint::{LintPass, LintArray, LateLintPass, LateContext};
|
||||
use rustc::middle::subst::ParamSpace;
|
||||
use rustc::middle::ty;
|
||||
use rustc::ty::subst::ParamSpace;
|
||||
use rustc::ty;
|
||||
use rustc_front::hir::Expr;
|
||||
use syntax::ast;
|
||||
use utils::{span_lint, MUTEX_PATH, match_type};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::middle::ty::TyStruct;
|
||||
use rustc::ty::TyStruct;
|
||||
use rustc_front::hir::{Expr, ExprStruct};
|
||||
use utils::span_lint;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use rustc::front::map::NodeItem;
|
||||
use rustc::lint::*;
|
||||
use rustc::middle::ty;
|
||||
use rustc::ty;
|
||||
use rustc_front::hir::*;
|
||||
use syntax::ast::NodeId;
|
||||
use utils::{STRING_PATH, VEC_PATH};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use rustc::lint::*;
|
||||
use rustc_front::hir::*;
|
||||
use rustc::middle::ty::TyS;
|
||||
use rustc::middle::ty::TypeVariants::TyRawPtr;
|
||||
use rustc::ty::TyS;
|
||||
use rustc::ty::TypeVariants::TyRawPtr;
|
||||
use utils;
|
||||
use utils::TRANSMUTE_PATH;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use reexport::*;
|
||||
use rustc::lint::*;
|
||||
use rustc::middle::{const_eval, def, ty};
|
||||
use rustc::middle::{const_eval, def};
|
||||
use rustc::ty;
|
||||
use rustc_front::hir::*;
|
||||
use rustc_front::intravisit::{FnKind, Visitor, walk_ty};
|
||||
use rustc_front::util::{is_comparison_binop, binop_to_string};
|
||||
|
|
|
@ -2,9 +2,12 @@ use reexport::*;
|
|||
use rustc::front::map::Node;
|
||||
use rustc::lint::{LintContext, LateContext, Level, Lint};
|
||||
use rustc::middle::def_id::DefId;
|
||||
use rustc::middle::traits::ProjectionMode;
|
||||
use rustc::middle::{cstore, def, infer, ty, traits};
|
||||
use rustc::middle::subst::Subst;
|
||||
use rustc::traits;
|
||||
use rustc::traits::ProjectionMode;
|
||||
use rustc::middle::{cstore, def};
|
||||
use rustc::infer;
|
||||
use rustc::ty;
|
||||
use rustc::ty::subst::Subst;
|
||||
use rustc::session::Session;
|
||||
use rustc_front::hir::*;
|
||||
use std::borrow::Cow;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use rustc::lint::*;
|
||||
use rustc::middle::ty::TypeVariants;
|
||||
use rustc::ty::TypeVariants;
|
||||
use rustc_front::hir::*;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::ptr::P;
|
||||
|
|
Loading…
Reference in a new issue