Skip to content

Commit

Permalink
Responded to comments and fixed compile bug
Browse files Browse the repository at this point in the history
Removed the hash of `let c: fn(_,_) -> _ = ExprKind::Cast` and
fixed compile issue by collecting HirVec into an actual Vec
  • Loading branch information
xd009642 committed Jul 26, 2019
1 parent c025917 commit 7853dac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions 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::*;

Expand Down Expand Up @@ -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));
Expand Down
4 changes: 1 addition & 3 deletions clippy_lints/src/utils/hir_utils.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
},
Expand Down

0 comments on commit 7853dac

Please sign in to comment.