]> git.lizzy.rs Git - rust.git/commitdiff
rustup
authorGeorg Brandl <georg@python.org>
Thu, 18 Aug 2016 18:36:42 +0000 (20:36 +0200)
committerGeorg Brandl <georg@python.org>
Thu, 18 Aug 2016 19:24:35 +0000 (21:24 +0200)
clippy_lints/src/derive.rs
clippy_lints/src/methods.rs
clippy_lints/src/mutex_atomic.rs
clippy_lints/src/vec.rs

index 4177b953b9470c4322ebd7899a960adddb69addc..2a0fca63e5dcbe303c9917982d005c7ec190d961 100644 (file)
@@ -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<Foo> for Foo`
-            if trait_ref.input_types()[0] == ty {
+            // For `impl PartialEq<B> 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 {
index c914d5210ecf3680a00df5b7469a919c9bad9e81..0dc6d5a3b4e9bd1cf2e37ed2c761932156ca3c6d 100644 (file)
@@ -2,7 +2,6 @@
 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<ty::Ty<'a>> {
         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);
         }
     }
index ff2d8b2115434fc1be276aafdcd592843c3dffdc..9cd17a07d715b79a6c9a9b5a5291e9bc6d367109 100644 (file)
@@ -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 @@ fn check_expr(&mut self, cx: &LateContext, expr: &Expr) {
         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<()>.",
index 38f3340c8b6e203872054e6cb1defdfdd9011289..6943cb2a8f084e4f83b76df45ea391c6e7c9ffa4 100644 (file)
@@ -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<T>`).
 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?");
     }