mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Trim extra space when suggesting removing bad let
This commit is contained in:
parent
65b3877488
commit
1136bbf066
@ -683,7 +683,9 @@ impl<'a> Parser<'a> {
|
|||||||
})
|
})
|
||||||
{
|
{
|
||||||
self.bump();
|
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;
|
lo = self.token.span;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,12 +2,12 @@ error: expected pattern, found `let`
|
|||||||
--> $DIR/unnecessary-let.rs:2:9
|
--> $DIR/unnecessary-let.rs:2:9
|
||||||
|
|
|
|
||||||
LL | for let x of [1, 2, 3] {}
|
LL | for let x of [1, 2, 3] {}
|
||||||
| ^^^
|
| ^^^^
|
||||||
|
|
|
|
||||||
help: remove the unnecessary `let` keyword
|
help: remove the unnecessary `let` keyword
|
||||||
|
|
|
|
||||||
LL - for let x of [1, 2, 3] {}
|
LL - for let x of [1, 2, 3] {}
|
||||||
LL + for x of [1, 2, 3] {}
|
LL + for x of [1, 2, 3] {}
|
||||||
|
|
|
|
||||||
|
|
||||||
error: missing `in` in `for` loop
|
error: missing `in` in `for` loop
|
||||||
@ -25,12 +25,12 @@ error: expected pattern, found `let`
|
|||||||
--> $DIR/unnecessary-let.rs:7:9
|
--> $DIR/unnecessary-let.rs:7:9
|
||||||
|
|
|
|
||||||
LL | let 1 => {}
|
LL | let 1 => {}
|
||||||
| ^^^
|
| ^^^^
|
||||||
|
|
|
|
||||||
help: remove the unnecessary `let` keyword
|
help: remove the unnecessary `let` keyword
|
||||||
|
|
|
|
||||||
LL - let 1 => {}
|
LL - let 1 => {}
|
||||||
LL + 1 => {}
|
LL + 1 => {}
|
||||||
|
|
|
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
Loading…
Reference in New Issue
Block a user