about summary refs log tree commit diff
diff options
context:
space:
mode:
authorxd009642 <danielmckenna93@gmail.com>2019-07-24 22:59:32 +0100
committerxd009642 <danielmckenna93@gmail.com>2019-07-24 22:59:32 +0100
commitc0259179c3c867e9b25894bf8139145d34359acc (patch)
tree0388aed118915f0a1095e86a37f65f352b1be63e
parent792153104c5af9948df6d8def8ab4b2611731eb6 (diff)
downloadrust-c0259179c3c867e9b25894bf8139145d34359acc.tar.gz
rust-c0259179c3c867e9b25894bf8139145d34359acc.zip
Fixed more compile errors
Moved to rustc::hir::Ty
-rw-r--r--clippy_lints/src/trait_bounds.rs6
-rw-r--r--clippy_lints/src/utils/hir_utils.rs18
2 files changed, 14 insertions, 10 deletions
diff --git a/clippy_lints/src/trait_bounds.rs b/clippy_lints/src/trait_bounds.rs
index e41437bf1f8..02514377dfb 100644
--- a/clippy_lints/src/trait_bounds.rs
+++ b/clippy_lints/src/trait_bounds.rs
@@ -28,13 +28,13 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TraitBounds {
         let mut map = FxHashMap::default();
         for bound in &gen.where_clause.predicates {
             if let WherePredicate::BoundPredicate(ref p) = bound {
-                let h = hash(&p.bounded_ty.node);
+                let h = hash(&p.bounded_ty);
                 if let Some(ref v) = map.insert(h, p.bounds) {
                     let mut hint_string = format!("consider combining the bounds: `{:?}: ", p.bounded_ty);
-                    for &b in v.iter() {
+                    for b in v.iter() {
                         hint_string.push_str(&format!("{:?}, ", b));
                     }
-                    for &b in p.bounds.iter() {
+                    for b in p.bounds.iter() {
                         hint_string.push_str(&format!("{:?}, ", b));
                     }
                     hint_string.truncate(hint_string.len() - 2);
diff --git a/clippy_lints/src/utils/hir_utils.rs b/clippy_lints/src/utils/hir_utils.rs
index 5304a9226ae..4330b55878c 100644
--- a/clippy_lints/src/utils/hir_utils.rs
+++ b/clippy_lints/src/utils/hir_utils.rs
@@ -3,7 +3,7 @@ use crate::utils::differing_macro_contexts;
 use rustc::hir::ptr::P;
 use rustc::hir::*;
 use rustc::lint::LateContext;
-use rustc::ty::{self, Ty, TypeckTables};
+use rustc::ty::{self, TypeckTables};
 use std::collections::hash_map::DefaultHasher;
 use std::hash::{Hash, Hasher};
 use syntax::ast::Name;
@@ -45,7 +45,7 @@ impl<'a, 'tcx> SpanlessEq<'a, 'tcx> {
         match (&left.node, &right.node) {
             (&StmtKind::Local(ref l), &StmtKind::Local(ref r)) => {
                 self.eq_pat(&l.pat, &r.pat)
-                    && both(&l.ty, &r.ty, |l, r| self.eq_ty(*l, *r))
+                    && both(&l.ty, &r.ty, |l, r| self.eq_ty(l, r))
                     && both(&l.init, &r.init, |l, r| self.eq_expr(l, r))
             },
             (&StmtKind::Expr(ref l), &StmtKind::Expr(ref r)) | (&StmtKind::Semi(ref l), &StmtKind::Semi(ref r)) => {
@@ -257,8 +257,8 @@ impl<'a, 'tcx> SpanlessEq<'a, 'tcx> {
         }
     }
 
-    pub fn eq_ty(&mut self, left: &Ty<'tcx>, right: &Ty<'tcx>) -> bool {
-        self.eq_ty_kind(&left.sty, &right.sty)
+    pub fn eq_ty(&mut self, left: &Ty, right: &Ty) -> bool {
+        self.eq_ty_kind(&left.node, &right.node)
     }
 
     #[allow(clippy::similar_names)]
@@ -604,8 +604,12 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
         }
     }
 
-    pub fn hash_ty(&mut self, ty: &TyKind) {
-        std::mem::discriminant(&ty.node).hash(&mut self.s);
+    pub fn hash_ty(&mut self, ty: &Ty) {
+        self.hash_tykind(&ty.node);
+    }
+
+    pub fn hash_tykind(&mut self, ty: &TyKind) {
+        std::mem::discriminant(&ty).hash(&mut self.s);
         match ty {
             TyKind::Slice(ty) => {
                 self.hash_ty(ty);
@@ -665,7 +669,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
                 for arg in arg_list {
                     match arg {
                         GenericArg::Lifetime(ref l) => self.hash_lifetime(l),
-                        GenericArg::Type(ref ty) => self.hash_ty(ty),
+                        GenericArg::Type(ref ty) => self.hash_ty(&ty),
                         GenericArg::Const(ref ca) => {
                             self.hash_expr(&self.cx.tcx.hir().body(ca.value.body).value);
                         },