about summary refs log tree commit diff
diff options
context:
space:
mode:
authorxd009642 <danielmckenna93@gmail.com>2019-07-26 16:46:47 +0100
committerxd009642 <danielmckenna93@gmail.com>2019-07-26 16:46:47 +0100
commit7853dac66245d88bace4cdc62b38837aa3e54568 (patch)
tree42221ef8eb1dba16982cae47bde125bdb6a3b059
parentc0259179c3c867e9b25894bf8139145d34359acc (diff)
downloadrust-7853dac66245d88bace4cdc62b38837aa3e54568.tar.gz
rust-7853dac66245d88bace4cdc62b38837aa3e54568.zip
Responded to comments and fixed compile bug
Removed the hash of `let c: fn(_,_) -> _ = ExprKind::Cast` and
fixed compile issue by collecting HirVec into an actual Vec
-rw-r--r--clippy_lints/src/trait_bounds.rs4
-rw-r--r--clippy_lints/src/utils/hir_utils.rs4
2 files changed, 3 insertions, 5 deletions
diff --git a/clippy_lints/src/trait_bounds.rs b/clippy_lints/src/trait_bounds.rs
index 02514377dfb..cb836eac3a6 100644
--- a/clippy_lints/src/trait_bounds.rs
+++ b/clippy_lints/src/trait_bounds.rs
@@ -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 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TraitBounds {
         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));
diff --git a/clippy_lints/src/utils/hir_utils.rs b/clippy_lints/src/utils/hir_utils.rs
index 4330b55878c..703c9fac1da 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, TypeckTables};
+use rustc::ty::TypeckTables;
 use std::collections::hash_map::DefaultHasher;
 use std::hash::{Hash, Hasher};
 use syntax::ast::Name;
@@ -439,8 +439,6 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
                 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);
             },