Skip to content

Commit

Permalink
rustup
Browse files Browse the repository at this point in the history
  • Loading branch information
birkenfeld committed Aug 18, 2016
1 parent 4c07c0a commit ff91937
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
3 changes: 2 additions & 1 deletion clippy_lints/src/derive.rs
Expand Up @@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/methods.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/mutex_atomic.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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<()>.",
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/vec.rs
Expand Up @@ -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?");
}
Expand Down

0 comments on commit ff91937

Please sign in to comment.