Rollup merge of #97370 - compiler-errors:else-no-if-2, r=Dylan-DPC
Minor improvement on else-no-if diagnostic Don't suggest wrapping in block since it's highly likely to be a missing `if` after `else`. Also rework message a bit (open to further suggestions). cc: https://github.com/rust-lang/rust/pull/97298#discussion_r880933431 r? `@estebank`
This commit is contained in:
commit
fe727e4dfc
2 changed files with 3 additions and 18 deletions
|
|
@ -6,14 +6,10 @@ LL | } else false {
|
|||
| |
|
||||
| expected an `if` or a block after this `else`
|
||||
|
|
||||
help: add an `if` if this is the condition to an chained `if` statement after the `else`
|
||||
help: add an `if` if this is the condition of a chained `else if` statement
|
||||
|
|
||||
LL | } else if false {
|
||||
| ++
|
||||
help: ... otherwise, place this expression inside of a block if it is not an `if` condition
|
||||
|
|
||||
LL | } else { false } {
|
||||
| + +
|
||||
|
||||
error: expected `{`, found `falsy`
|
||||
--> $DIR/else-no-if.rs:10:12
|
||||
|
|
@ -23,14 +19,10 @@ LL | } else falsy() {
|
|||
| |
|
||||
| expected an `if` or a block after this `else`
|
||||
|
|
||||
help: add an `if` if this is the condition to an chained `if` statement after the `else`
|
||||
help: add an `if` if this is the condition of a chained `else if` statement
|
||||
|
|
||||
LL | } else if falsy() {
|
||||
| ++
|
||||
help: ... otherwise, place this expression inside of a block if it is not an `if` condition
|
||||
|
|
||||
LL | } else { falsy() } {
|
||||
| + +
|
||||
|
||||
error: expected `{`, found `falsy`
|
||||
--> $DIR/else-no-if.rs:17:12
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue