]> git.lizzy.rs Git - rust.git/commitdiff
Respond to comments and improve printout
authorxd009642 <danielmckenna93@gmail.com>
Sat, 27 Jul 2019 10:51:27 +0000 (11:51 +0100)
committerxd009642 <danielmckenna93@gmail.com>
Sat, 27 Jul 2019 10:51:27 +0000 (11:51 +0100)
Now get the trait names for the diagnostic message and removed more
`let c: fn(_) -> _ = T; hashes from hir_utils

clippy_lints/src/trait_bounds.rs
clippy_lints/src/utils/hir_utils.rs

index cb836eac3a6f1355a512e23b86a7fa8fd494617e..3ef353a978fae6ae147754b904123e0abaad9b82 100644 (file)
@@ -32,10 +32,16 @@ fn check_generics(&mut self, cx: &LateContext<'a, 'tcx>, gen: &'tcx Generics) {
                 if let Some(ref v) = map.insert(h, p.bounds.iter().collect::<Vec<_>>()) {
                     let mut hint_string = format!("consider combining the bounds: `{:?}: ", p.bounded_ty);
                     for b in v.iter() {
-                        hint_string.push_str(&format!("{:?}, ", b));
+                        if let GenericBound::Trait(ref poly_trait_ref, _) = b {
+                            let path = &poly_trait_ref.trait_ref.path;
+                            hint_string.push_str(&format!("{}, ", path));
+                        }
                     }
                     for b in p.bounds.iter() {
-                        hint_string.push_str(&format!("{:?}, ", b));
+                        if let GenericBound::Trait(ref poly_trait_ref, _) = b {
+                            let path = &poly_trait_ref.trait_ref.path;
+                            hint_string.push_str(&format!("{}, ", path));
+                        }
                     }
                     hint_string.truncate(hint_string.len() - 2);
                     hint_string.push('`');
index 703c9fac1dac837287272af97f8f09c3c5033458..449b8c4397da7560185914bb584577641e3c5264 100644 (file)
@@ -513,18 +513,12 @@ pub fn hash_expr(&mut self, e: &Expr) {
                 }
             },
             ExprKind::Tup(ref tup) => {
-                let c: fn(_) -> _ = ExprKind::Tup;
-                c.hash(&mut self.s);
                 self.hash_exprs(tup);
             },
             ExprKind::Array(ref v) => {
-                let c: fn(_) -> _ = ExprKind::Array;
-                c.hash(&mut self.s);
                 self.hash_exprs(v);
             },
             ExprKind::Type(ref e, ref ty) => {
-                let c: fn(_, _) -> _ = ExprKind::Type;
-                c.hash(&mut self.s);
                 self.hash_expr(e);
                 self.hash_ty(ty);
             },