From ff919376a67a2c9a113b8fae33b297273c95be8f Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Thu, 18 Aug 2016 20:36:42 +0200 Subject: [PATCH] rustup --- clippy_lints/src/derive.rs | 3 ++- clippy_lints/src/methods.rs | 3 +-- clippy_lints/src/mutex_atomic.rs | 3 +-- clippy_lints/src/vec.rs | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/clippy_lints/src/derive.rs b/clippy_lints/src/derive.rs index 4177b953b94..2a0fca63e5d 100644 --- a/clippy_lints/src/derive.rs +++ b/clippy_lints/src/derive.rs @@ -106,7 +106,8 @@ fn check_hash_peq<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, span: Span, trait_re let trait_ref = cx.tcx.impl_trait_ref(impl_id).expect("must be a trait implementation"); // Only care about `impl PartialEq for Foo` - if trait_ref.input_types()[0] == ty { + // For `impl PartialEq for A, input_types is [A, B] + if trait_ref.input_types()[1] == ty { let mess = if peq_is_automatically_derived { "you are implementing `Hash` explicitly but have derived `PartialEq`" } else { diff --git a/clippy_lints/src/methods.rs b/clippy_lints/src/methods.rs index c914d5210ec..0dc6d5a3b4e 100644 --- a/clippy_lints/src/methods.rs +++ b/clippy_lints/src/methods.rs @@ -2,7 +2,6 @@ use rustc::hir; use rustc::lint::*; use rustc::middle::const_val::ConstVal; use rustc::middle::const_qualif::ConstQualif; -use rustc::ty::subst::TypeSpace; use rustc::ty; use rustc_const_eval::EvalHint::ExprTypeChecked; use rustc_const_eval::eval_const_expr_partial; @@ -1085,7 +1084,7 @@ fn get_error_type<'a>(cx: &LateContext, ty: ty::Ty<'a>) -> Option> { return None; } if let ty::TyEnum(_, substs) = ty.sty { - if let Some(err_ty) = substs.types.opt_get(TypeSpace, 1) { + if let Some(err_ty) = substs.types.get(1) { return Some(err_ty); } } diff --git a/clippy_lints/src/mutex_atomic.rs b/clippy_lints/src/mutex_atomic.rs index ff2d8b21154..9cd17a07d71 100644 --- a/clippy_lints/src/mutex_atomic.rs +++ b/clippy_lints/src/mutex_atomic.rs @@ -3,7 +3,6 @@ //! This lint is **warn** by default use rustc::lint::{LintPass, LintArray, LateLintPass, LateContext}; -use rustc::ty::subst::ParamSpace; use rustc::ty; use rustc::hir::Expr; use syntax::ast; @@ -60,7 +59,7 @@ impl LateLintPass for MutexAtomic { let ty = cx.tcx.expr_ty(expr); if let ty::TyStruct(_, subst) = ty.sty { if match_type(cx, ty, &paths::MUTEX) { - let mutex_param = &subst.types.get(ParamSpace::TypeSpace, 0).sty; + let mutex_param = &subst.types[0].sty; if let Some(atomic_name) = get_atomic_name(mutex_param) { let msg = format!("Consider using an {} instead of a Mutex here. If you just want the locking \ behaviour and not the internal type, consider using Mutex<()>.", diff --git a/clippy_lints/src/vec.rs b/clippy_lints/src/vec.rs index 38f3340c8b6..6943cb2a8f0 100644 --- a/clippy_lints/src/vec.rs +++ b/clippy_lints/src/vec.rs @@ -89,7 +89,7 @@ fn check_vec_macro(cx: &LateContext, vec_args: &higher::VecArgs, span: Span) { /// Return the item type of the vector (ie. the `T` in `Vec`). fn vec_type(ty: ty::Ty) -> ty::Ty { if let ty::TyStruct(_, substs) = ty.sty { - substs.types.get(ty::subst::ParamSpace::TypeSpace, 0) + substs.types[0] } else { panic!("The type of `vec!` is a not a struct?"); }