Skip to content

Commit 7a459ba

Browse files
committed
Remove suggestion to remove as_str
1 parent d8ac0ec commit 7a459ba

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

compiler/rustc_hir_typeck/src/method/suggest.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,20 +1719,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
17191719
}
17201720
}
17211721

1722-
if item_name.name == sym::as_str && rcvr_ty.peel_refs().is_str() {
1723-
let msg = "remove this method call";
1724-
let mut fallback_span = true;
1725-
if let SelfSource::MethodCall(expr) = source {
1726-
let call_expr = self.tcx.hir().expect_expr(self.tcx.parent_hir_id(expr.hir_id));
1727-
if let Some(span) = call_expr.span.trim_start(expr.span) {
1728-
err.span_suggestion(span, msg, "", Applicability::MachineApplicable);
1729-
fallback_span = false;
1730-
}
1731-
}
1732-
if fallback_span {
1733-
err.span_label(span, msg);
1734-
}
1735-
} else if let Some(similar_candidate) = similar_candidate {
1722+
if let Some(similar_candidate) = similar_candidate {
17361723
// Don't emit a suggestion if we found an actual method
17371724
// that had unsatisfied trait bounds
17381725
if unsatisfied_predicates.is_empty()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy