about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-05-25 10:48:30 +0200
committerGitHub <noreply@github.com>2022-05-25 10:48:30 +0200
commitfe727e4dfc560ad5c973d04cd4e98ea943b463de (patch)
treea1cdad623abe3e4cb86b8c93d35669c7ff0e3f2b /src
parentca269b1e797c7d5da4e90ba0bdb06eae7f3dcfd9 (diff)
parentd61d30d9a272f8c2cce374a6f8aca5ae5d3de124 (diff)
downloadrust-fe727e4dfc560ad5c973d04cd4e98ea943b463de.tar.gz
rust-fe727e4dfc560ad5c973d04cd4e98ea943b463de.zip
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`
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/parser/else-no-if.stderr12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/test/ui/parser/else-no-if.stderr b/src/test/ui/parser/else-no-if.stderr
index 27abbadd7ad..b9c1a75276c 100644
--- a/src/test/ui/parser/else-no-if.stderr
+++ b/src/test/ui/parser/else-no-if.stderr
@@ -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