summary refs log tree commit diff
path: root/src/test/ui/parser
diff options
context:
space:
mode:
authorNoah Lev <camelidcamel@gmail.com>2022-02-17 14:52:52 -0800
committerNoah Lev <camelidcamel@gmail.com>2022-03-23 22:31:57 -0700
commit62b8ea67b79de77fca36ca82de4b934307b6de30 (patch)
tree1c2818418eefb84dcc63361b6a1bce2ddd7b90bc /src/test/ui/parser
parent7287f929b9c4a684be6ea8980970de7693eef841 (diff)
downloadrust-62b8ea67b79de77fca36ca82de4b934307b6de30.tar.gz
rust-62b8ea67b79de77fca36ca82de4b934307b6de30.zip
Emit both subexp and standalone sugg for postfix
This solves the TODO.
Diffstat (limited to 'src/test/ui/parser')
-rw-r--r--src/test/ui/parser/increment-autofix.stderr10
-rw-r--r--src/test/ui/parser/increment-notfixed.stderr5
2 files changed, 15 insertions, 0 deletions
diff --git a/src/test/ui/parser/increment-autofix.stderr b/src/test/ui/parser/increment-autofix.stderr
index 46ab48f3684..e5386c7bdba 100644
--- a/src/test/ui/parser/increment-autofix.stderr
+++ b/src/test/ui/parser/increment-autofix.stderr
@@ -8,6 +8,11 @@ help: use `+= 1` instead
    |
 LL |     { let tmp = i; i += 1; tmp };
    |     +++++++++++  ~~~~~~~~~~~~~~~
+help: or, if you don't need to use it as an expression, change it to this
+   |
+LL -     i++;
+LL +     i += 1;
+   | 
 
 error: Rust has no postfix increment operator
   --> $DIR/increment-autofix.rs:11:12
@@ -19,6 +24,11 @@ help: use `+= 1` instead
    |
 LL |     while { let tmp = i; i += 1; tmp } < 5 {
    |           +++++++++++  ~~~~~~~~~~~~~~~
+help: or, if you don't need to use it as an expression, change it to this
+   |
+LL -     while i++ < 5 {
+LL +     while i += 1 < 5 {
+   | 
 
 error: Rust has no prefix increment operator
   --> $DIR/increment-autofix.rs:19:5
diff --git a/src/test/ui/parser/increment-notfixed.stderr b/src/test/ui/parser/increment-notfixed.stderr
index 3110e242712..43586c4c25e 100644
--- a/src/test/ui/parser/increment-notfixed.stderr
+++ b/src/test/ui/parser/increment-notfixed.stderr
@@ -8,6 +8,11 @@ help: use `+= 1` instead
    |
 LL |     { let tmp = foo.bar.qux; foo.bar.qux += 1; tmp };
    |     +++++++++++            ~~~~~~~~~~~~~~~~~~~~~~~~~
+help: or, if you don't need to use it as an expression, change it to this
+   |
+LL -     foo.bar.qux++;
+LL +     foo.bar.qux += 1;
+   | 
 
 error: Rust has no prefix increment operator
   --> $DIR/increment-notfixed.rs:18:5