From aa819b7748b8aa6ae03ddcdc993b6dff1ba26912 Mon Sep 17 00:00:00 2001 From: josephDunne Date: Sun, 27 Mar 2016 19:59:02 +0100 Subject: [PATCH] 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) --- CONTRIBUTING.md | 2 +- src/array_indexing.rs | 2 +- src/copies.rs | 2 +- src/cyclomatic_complexity.rs | 4 ++-- src/derive.rs | 8 ++++---- src/drop_ref.rs | 2 +- src/enum_glob_use.rs | 7 ++++--- src/escape.rs | 8 ++++---- src/eta_reduction.rs | 2 +- src/format.rs | 2 +- src/len_zero.rs | 2 +- src/loops.rs | 2 +- src/matches.rs | 2 +- src/methods.rs | 4 ++-- src/misc.rs | 2 +- src/mut_mut.rs | 2 +- src/mut_reference.rs | 2 +- src/mutex_atomic.rs | 4 ++-- src/needless_update.rs | 2 +- src/ptr_arg.rs | 2 +- src/transmute.rs | 4 ++-- src/types.rs | 3 ++- src/utils/mod.rs | 9 ++++++--- src/vec.rs | 2 +- 24 files changed, 43 insertions(+), 38 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ac094d1c828..d7b181c8bdb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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. diff --git a/src/array_indexing.rs b/src/array_indexing.rs index ece66ae20a2..344a8b8c34e 100644 --- a/src/array_indexing.rs +++ b/src/array_indexing.rs @@ -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; diff --git a/src/copies.rs b/src/copies.rs index 691acad6e92..789f852c6c3 100644 --- a/src/copies.rs +++ b/src/copies.rs @@ -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; diff --git a/src/cyclomatic_complexity.rs b/src/cyclomatic_complexity.rs index a03a42f2bc0..3db080f970e 100644 --- a/src/cyclomatic_complexity.rs +++ b/src/cyclomatic_complexity.rs @@ -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; diff --git a/src/derive.rs b/src/derive.rs index 380ff0a30f9..4a20d8018de 100644 --- a/src/derive.rs +++ b/src/derive.rs @@ -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; diff --git a/src/drop_ref.rs b/src/drop_ref.rs index 5f7e67925bd..7536fb1b63b 100644 --- a/src/drop_ref.rs +++ b/src/drop_ref.rs @@ -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; diff --git a/src/enum_glob_use.rs b/src/enum_glob_use.rs index 7924623c189..63f5886fec8 100644 --- a/src/enum_glob_use.rs +++ b/src/enum_glob_use.rs @@ -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"); } diff --git a/src/escape.rs b/src/escape.rs index f81a05d43d5..51c4c7b6f5d 100644 --- a/src/escape.rs +++ b/src/escape.rs @@ -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; diff --git a/src/eta_reduction.rs b/src/eta_reduction.rs index 6335f3f1398..bae971f46ac 100644 --- a/src/eta_reduction.rs +++ b/src/eta_reduction.rs @@ -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}; diff --git a/src/format.rs b/src/format.rs index f0b8485b4a4..300b3d17b39 100644 --- a/src/format.rs +++ b/src/format.rs @@ -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}; diff --git a/src/len_zero.rs b/src/len_zero.rs index e61c77adf24..6dad8684354 100644 --- a/src/len_zero.rs +++ b/src/len_zero.rs @@ -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}; diff --git a/src/loops.rs b/src/loops.rs index 7987c70d027..c0d3993746a 100644 --- a/src/loops.rs +++ b/src/loops.rs @@ -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; diff --git a/src/matches.rs b/src/matches.rs index a456a816f62..bc3b45b32ef 100644 --- a/src/matches.rs +++ b/src/matches.rs @@ -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; diff --git a/src/methods.rs b/src/methods.rs index 81761695eb8..b8bbc0e9068 100644 --- a/src/methods.rs +++ b/src/methods.rs @@ -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; diff --git a/src/misc.rs b/src/misc.rs index 55439e6a78b..49426d5d5de 100644 --- a/src/misc.rs +++ b/src/misc.rs @@ -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}; diff --git a/src/mut_mut.rs b/src/mut_mut.rs index c8f86330b93..a5ed233241d 100644 --- a/src/mut_mut.rs +++ b/src/mut_mut.rs @@ -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}; diff --git a/src/mut_reference.rs b/src/mut_reference.rs index 707ce8efaeb..95ed1092eb5 100644 --- a/src/mut_reference.rs +++ b/src/mut_reference.rs @@ -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; diff --git a/src/mutex_atomic.rs b/src/mutex_atomic.rs index c8f5e3c7919..0593438cfc1 100644 --- a/src/mutex_atomic.rs +++ b/src/mutex_atomic.rs @@ -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}; diff --git a/src/needless_update.rs b/src/needless_update.rs index e3359469150..d25f66ca434 100644 --- a/src/needless_update.rs +++ b/src/needless_update.rs @@ -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; diff --git a/src/ptr_arg.rs b/src/ptr_arg.rs index 85baf3310c3..b7882bfda16 100644 --- a/src/ptr_arg.rs +++ b/src/ptr_arg.rs @@ -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}; diff --git a/src/transmute.rs b/src/transmute.rs index 488d214b21f..8689a7e3668 100644 --- a/src/transmute.rs +++ b/src/transmute.rs @@ -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; diff --git a/src/types.rs b/src/types.rs index 742298622fc..c2fc242ec53 100644 --- a/src/types.rs +++ b/src/types.rs @@ -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}; diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 6ef0853fdd7..017890dc461 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -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; diff --git a/src/vec.rs b/src/vec.rs index dda552bc8f9..481c84079f2 100644 --- a/src/vec.rs +++ b/src/vec.rs @@ -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;