Skip to content

Commit 666d1a8

Browse files
authored
Rollup merge of #79824 - LingMan:no_replace, r=lcnr
Strip prefix instead of replacing it with empty string r? `@lcnr,` since you reviewed my other PR in the area. `@rustbot` modify labels +C-cleanup +T-compiler
2 parents 3b49a46 + 06aa7a7 commit 666d1a8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/rustc_typeck/src/check/demand.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -548,11 +548,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
548548
// we may want to suggest removing a `&`.
549549
if sm.is_imported(expr.span) {
550550
if let Ok(src) = sm.span_to_snippet(sp) {
551-
if let Some(src) = self.replace_prefix(&src, "&", "") {
551+
if let Some(src) = src.strip_prefix('&') {
552552
return Some((
553553
sp,
554554
"consider removing the borrow",
555-
src,
555+
src.to_string(),
556556
Applicability::MachineApplicable,
557557
));
558558
}

0 commit comments

Comments
 (0)