mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-12 18:07:40 +00:00
Fix cargo crash
This commit is contained in:
parent
0a49935270
commit
eda73fe707
@ -2460,14 +2460,13 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for ImplicitHasherConstructorVisitor<'a, 'b, 't
|
|||||||
if_chain! {
|
if_chain! {
|
||||||
if let ExprKind::Call(ref fun, ref args) = e.kind;
|
if let ExprKind::Call(ref fun, ref args) = e.kind;
|
||||||
if let ExprKind::Path(QPath::TypeRelative(ref ty, ref method)) = fun.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 {
|
then {
|
||||||
if !same_tys(self.cx, self.target.ty(), self.body.expr_ty(e)) {
|
if !same_tys(self.cx, self.target.ty(), self.body.expr_ty(e)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let ty = hir_ty_to_ty(self.cx.tcx, ty);
|
if match_path(ty_path, &paths::HASHMAP) {
|
||||||
|
|
||||||
if is_type_diagnostic_item(self.cx, ty, sym!(hashmap_type)) {
|
|
||||||
if method.ident.name == sym!(new) {
|
if method.ident.name == sym!(new) {
|
||||||
self.suggestions
|
self.suggestions
|
||||||
.insert(e.span, "HashMap::default()".to_string());
|
.insert(e.span, "HashMap::default()".to_string());
|
||||||
@ -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) {
|
if method.ident.name == sym!(new) {
|
||||||
self.suggestions
|
self.suggestions
|
||||||
.insert(e.span, "HashSet::default()".to_string());
|
.insert(e.span, "HashSet::default()".to_string());
|
||||||
|
Loading…
Reference in New Issue
Block a user