about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMartin Nordholts <martin.nordholts@codetale.se>2024-12-16 20:31:06 +0100
committerMartin Nordholts <martin.nordholts@codetale.se>2024-12-16 20:44:07 +0100
commit47b559d00e8723b407dd44b0d1e004bd43bab8c8 (patch)
tree98fdb4235fd4b9d8f7a46ebe95be7be68a9f6b2f
parentbfb027a50da1cd398159f09a7ce0acbf87b33eac (diff)
rustc_borrowck: suggest_ampmut(): Inline unneeded local var
Since the previos commit renamed `assignment_rhs_span` to just
`rhs_span` there is no need for a variable just to shorten the
expression on the next line. Inline the variable.
-rw-r--r--compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs
index ed249555ae4..73b76cd16d1 100644
--- a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs
+++ b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs
@@ -1500,9 +1500,8 @@ fn suggest_ampmut<'tcx>(
         // if the reference is already mutable then there is nothing we can do
         // here.
         if !is_mut {
-            let span = rhs_span;
             // shrink the span to just after the `&` in `&variable`
-            let span = span.with_lo(span.lo() + BytePos(1)).shrink_to_lo();
+            let span = rhs_span.with_lo(rhs_span.lo() + BytePos(1)).shrink_to_lo();
 
             // FIXME(Ezrashaw): returning is bad because we still might want to
             // update the annotated type, see #106857.