Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix cargo crash
  • Loading branch information
phansch committed Apr 26, 2020
commit eda73fe707ed680c89e5a080318f6fa7b555616e
7 changes: 3 additions & 4 deletions clippy_lints/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2460,14 +2460,13 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for ImplicitHasherConstructorVisitor<'a, 'b, 't
if_chain! {
if let ExprKind::Call(ref fun, ref args) = e.kind;
if let ExprKind::Path(QPath::TypeRelative(ref ty, ref method)) = fun.kind;
if let TyKind::Path(QPath::Resolved(None, ty_path)) = ty.kind;
then {
if !same_tys(self.cx, self.target.ty(), self.body.expr_ty(e)) {
return;
}

let ty = hir_ty_to_ty(self.cx.tcx, ty);

if is_type_diagnostic_item(self.cx, ty, sym!(hashmap_type)) {
if match_path(ty_path, &paths::HASHMAP) {
if method.ident.name == sym!(new) {
self.suggestions
.insert(e.span, "HashMap::default()".to_string());
Expand All @@ -2480,7 +2479,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for ImplicitHasherConstructorVisitor<'a, 'b, 't
),
);
}
} else if is_type_diagnostic_item(self.cx, ty, sym!(hashset_type)) {
} else if match_path(ty_path, &paths::HASHSET) {
if method.ident.name == sym!(new) {
self.suggestions
.insert(e.span, "HashSet::default()".to_string());
Expand Down