From 62b8ea67b79de77fca36ca82de4b934307b6de30 Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Thu, 17 Feb 2022 14:52:52 -0800 Subject: Emit both subexp and standalone sugg for postfix This solves the TODO. --- src/test/ui/parser/increment-autofix.stderr | 10 ++++++++++ src/test/ui/parser/increment-notfixed.stderr | 5 +++++ 2 files changed, 15 insertions(+) (limited to 'src/test/ui/parser') 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 -- cgit 1.4.1-3-g733a5