]> git.lizzy.rs Git - rust.git/commitdiff
Responded to comments and fixed compile bug
authorxd009642 <danielmckenna93@gmail.com>
Fri, 26 Jul 2019 15:46:47 +0000 (16:46 +0100)
committerxd009642 <danielmckenna93@gmail.com>
Fri, 26 Jul 2019 15:46:47 +0000 (16:46 +0100)
Removed the hash of `let c: fn(_,_) -> _ = ExprKind::Cast` and
fixed compile issue by collecting HirVec into an actual Vec

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

index 02514377dfb4e25986d05feba74eee0018a5ada9..cb836eac3a6f1355a512e23b86a7fa8fd494617e 100644 (file)
@@ -1,6 +1,6 @@
 use crate::utils::{in_macro, span_help_and_lint, SpanlessHash};
 use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
-use rustc::{declare_tool_lint, lint_array, impl_lint_pass};
+use rustc::{declare_tool_lint, impl_lint_pass};
 use rustc_data_structures::fx::FxHashMap;
 use rustc::hir::*;
 
@@ -29,7 +29,7 @@ fn check_generics(&mut self, cx: &LateContext<'a, 'tcx>, gen: &'tcx Generics) {
         for bound in &gen.where_clause.predicates {
             if let WherePredicate::BoundPredicate(ref p) = bound {
                 let h = hash(&p.bounded_ty);
-                if let Some(ref v) = map.insert(h, p.bounds) {
+                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));
index 4330b55878c3dab8d2f31b9e2032cd647c179d43..703c9fac1dac837287272af97f8f09c3c5033458 100644 (file)
@@ -3,7 +3,7 @@
 use rustc::hir::ptr::P;
 use rustc::hir::*;
 use rustc::lint::LateContext;
-use rustc::ty::{self, TypeckTables};
+use rustc::ty::TypeckTables;
 use std::collections::hash_map::DefaultHasher;
 use std::hash::{Hash, Hasher};
 use syntax::ast::Name;
@@ -439,8 +439,6 @@ pub fn hash_expr(&mut self, e: &Expr) {
                 self.hash_exprs(args);
             },
             ExprKind::Cast(ref e, ref ty) => {
-                let c: fn(_, _) -> _ = ExprKind::Cast;
-                c.hash(&mut self.s);
                 self.hash_expr(e);
                 self.hash_ty(ty);
             },