File tree 2 files changed +3
-18
lines changed
compiler/rustc_parse/src/parser
2 files changed +3
-18
lines changed Original file line number Diff line number Diff line change @@ -2291,16 +2291,9 @@ impl<'a> Parser<'a> {
2291
2291
. span_label ( else_span, "expected an `if` or a block after this `else`" )
2292
2292
. span_suggestion (
2293
2293
cond. span . shrink_to_lo ( ) ,
2294
- "add an `if` if this is the condition to an chained `if` statement after the `else` " ,
2294
+ "add an `if` if this is the condition of a chained `else if` statement" ,
2295
2295
"if " . to_string ( ) ,
2296
2296
Applicability :: MaybeIncorrect ,
2297
- ) . multipart_suggestion (
2298
- "... otherwise, place this expression inside of a block if it is not an `if` condition" ,
2299
- vec ! [
2300
- ( cond. span. shrink_to_lo( ) , "{ " . to_string( ) ) ,
2301
- ( cond. span. shrink_to_hi( ) , " }" . to_string( ) ) ,
2302
- ] ,
2303
- Applicability :: MaybeIncorrect ,
2304
2297
)
2305
2298
. emit ( ) ;
2306
2299
self . parse_if_after_cond ( AttrVec :: new ( ) , cond. span . shrink_to_lo ( ) , cond) ?
Original file line number Diff line number Diff line change @@ -6,14 +6,10 @@ LL | } else false {
6
6
| |
7
7
| expected an `if` or a block after this `else`
8
8
|
9
- help: add an `if` if this is the condition to an chained `if` statement after the `else`
9
+ help: add an `if` if this is the condition of a chained `else if` statement
10
10
|
11
11
LL | } else if false {
12
12
| ++
13
- help: ... otherwise, place this expression inside of a block if it is not an `if` condition
14
- |
15
- LL | } else { false } {
16
- | + +
17
13
18
14
error: expected `{`, found `falsy`
19
15
--> $DIR/else-no-if.rs:10:12
@@ -23,14 +19,10 @@ LL | } else falsy() {
23
19
| |
24
20
| expected an `if` or a block after this `else`
25
21
|
26
- help: add an `if` if this is the condition to an chained `if` statement after the `else`
22
+ help: add an `if` if this is the condition of a chained `else if` statement
27
23
|
28
24
LL | } else if falsy() {
29
25
| ++
30
- help: ... otherwise, place this expression inside of a block if it is not an `if` condition
31
- |
32
- LL | } else { falsy() } {
33
- | + +
34
26
35
27
error: expected `{`, found `falsy`
36
28
--> $DIR/else-no-if.rs:17:12
You can’t perform that action at this time.
0 commit comments