Skip to content

Commit 06aa7a7

Browse files
committed
Strip prefix instead of replacing it with empty string
1 parent 3d6705a commit 06aa7a7

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
@@ -552,11 +552,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
552552
// we may want to suggest removing a `&`.
553553
if sm.is_imported(expr.span) {
554554
if let Ok(src) = sm.span_to_snippet(sp) {
555-
if let Some(src) = self.replace_prefix(&src, "&", "") {
555+
if let Some(src) = src.strip_prefix('&') {
556556
return Some((
557557
sp,
558558
"consider removing the borrow",
559-
src,
559+
src.to_string(),
560560
Applicability::MachineApplicable,
561561
));
562562
}

0 commit comments

Comments
 (0)