mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 15:11:30 +00:00
Respond to comments and improve printout
Now get the trait names for the diagnostic message and removed more `let c: fn(_) -> _ = T; hashes from hir_utils
This commit is contained in:
parent
7853dac662
commit
cac69ec063
2 changed files with 8 additions and 8 deletions
|
@ -32,10 +32,16 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TraitBounds {
|
|||
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('`');
|
||||
|
|
|
@ -513,18 +513,12 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
|
|||
}
|
||||
},
|
||||
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);
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue