Skip to content

Commit eda73fe

Browse files
committed
Fix cargo crash
1 parent 0a49935 commit eda73fe

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

clippy_lints/src/types.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -2460,14 +2460,13 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for ImplicitHasherConstructorVisitor<'a, 'b, 't
24602460
if_chain! {
24612461
if let ExprKind::Call(ref fun, ref args) = e.kind;
24622462
if let ExprKind::Path(QPath::TypeRelative(ref ty, ref method)) = fun.kind;
2463+
if let TyKind::Path(QPath::Resolved(None, ty_path)) = ty.kind;
24632464
then {
24642465
if !same_tys(self.cx, self.target.ty(), self.body.expr_ty(e)) {
24652466
return;
24662467
}
24672468

2468-
let ty = hir_ty_to_ty(self.cx.tcx, ty);
2469-
2470-
if is_type_diagnostic_item(self.cx, ty, sym!(hashmap_type)) {
2469+
if match_path(ty_path, &paths::HASHMAP) {
24712470
if method.ident.name == sym!(new) {
24722471
self.suggestions
24732472
.insert(e.span, "HashMap::default()".to_string());
@@ -2480,7 +2479,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for ImplicitHasherConstructorVisitor<'a, 'b, 't
24802479
),
24812480
);
24822481
}
2483-
} else if is_type_diagnostic_item(self.cx, ty, sym!(hashset_type)) {
2482+
} else if match_path(ty_path, &paths::HASHSET) {
24842483
if method.ident.name == sym!(new) {
24852484
self.suggestions
24862485
.insert(e.span, "HashSet::default()".to_string());

0 commit comments

Comments
 (0)