1
Fork 0

Trim extra space when suggesting removing bad let

This commit is contained in:
clubby789 2024-11-13 13:17:01 +00:00
parent 65b3877488
commit 1136bbf066
2 changed files with 7 additions and 5 deletions

View file

@ -683,7 +683,9 @@ impl<'a> Parser<'a> {
})
{
self.bump();
self.dcx().emit_err(RemoveLet { span: lo });
// Trim extra space after the `let`
let span = lo.with_hi(self.token.span.lo());
self.dcx().emit_err(RemoveLet { span });
lo = self.token.span;
}

View file

@ -2,7 +2,7 @@ error: expected pattern, found `let`
--> $DIR/unnecessary-let.rs:2:9
|
LL | for let x of [1, 2, 3] {}
| ^^^
| ^^^^
|
help: remove the unnecessary `let` keyword
|
@ -25,7 +25,7 @@ error: expected pattern, found `let`
--> $DIR/unnecessary-let.rs:7:9
|
LL | let 1 => {}
| ^^^
| ^^^^
|
help: remove the unnecessary `let` keyword
|