Skip to content

Commit

Permalink
rustc_borrowck: suggest_ampmut(): Inline unneeded local var
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Enselic committed Dec 16, 2024
1 parent bfb027a commit 47b559d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 47b559d

Please sign in to comment.