Skip to content

Commit 5fff9e4

Browse files
authored
Merge pull request #1176 from birkenfeld/master
rustup
2 parents 4c07c0a + ff91937 commit 5fff9e4

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

clippy_lints/src/derive.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ fn check_hash_peq<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, span: Span, trait_re
106106
let trait_ref = cx.tcx.impl_trait_ref(impl_id).expect("must be a trait implementation");
107107

108108
// Only care about `impl PartialEq<Foo> for Foo`
109-
if trait_ref.input_types()[0] == ty {
109+
// For `impl PartialEq<B> for A, input_types is [A, B]
110+
if trait_ref.input_types()[1] == ty {
110111
let mess = if peq_is_automatically_derived {
111112
"you are implementing `Hash` explicitly but have derived `PartialEq`"
112113
} else {

clippy_lints/src/methods.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use rustc::hir;
22
use rustc::lint::*;
33
use rustc::middle::const_val::ConstVal;
44
use rustc::middle::const_qualif::ConstQualif;
5-
use rustc::ty::subst::TypeSpace;
65
use rustc::ty;
76
use rustc_const_eval::EvalHint::ExprTypeChecked;
87
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>> {
10851084
return None;
10861085
}
10871086
if let ty::TyEnum(_, substs) = ty.sty {
1088-
if let Some(err_ty) = substs.types.opt_get(TypeSpace, 1) {
1087+
if let Some(err_ty) = substs.types.get(1) {
10891088
return Some(err_ty);
10901089
}
10911090
}

clippy_lints/src/mutex_atomic.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
//! This lint is **warn** by default
44
55
use rustc::lint::{LintPass, LintArray, LateLintPass, LateContext};
6-
use rustc::ty::subst::ParamSpace;
76
use rustc::ty;
87
use rustc::hir::Expr;
98
use syntax::ast;
@@ -60,7 +59,7 @@ impl LateLintPass for MutexAtomic {
6059
let ty = cx.tcx.expr_ty(expr);
6160
if let ty::TyStruct(_, subst) = ty.sty {
6261
if match_type(cx, ty, &paths::MUTEX) {
63-
let mutex_param = &subst.types.get(ParamSpace::TypeSpace, 0).sty;
62+
let mutex_param = &subst.types[0].sty;
6463
if let Some(atomic_name) = get_atomic_name(mutex_param) {
6564
let msg = format!("Consider using an {} instead of a Mutex here. If you just want the locking \
6665
behaviour and not the internal type, consider using Mutex<()>.",

clippy_lints/src/vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ fn check_vec_macro(cx: &LateContext, vec_args: &higher::VecArgs, span: Span) {
8989
/// Return the item type of the vector (ie. the `T` in `Vec<T>`).
9090
fn vec_type(ty: ty::Ty) -> ty::Ty {
9191
if let ty::TyStruct(_, substs) = ty.sty {
92-
substs.types.get(ty::subst::ParamSpace::TypeSpace, 0)
92+
substs.types[0]
9393
} else {
9494
panic!("The type of `vec!` is a not a struct?");
9595
}

0 commit comments

Comments
 (0)