diff --git a/tests/ui/try-block/try-block-unused-delims.fixed b/tests/ui/try-block/try-block-unused-delims.current.fixed similarity index 81% rename from tests/ui/try-block/try-block-unused-delims.fixed rename to tests/ui/try-block/try-block-unused-delims.current.fixed index 4769c45d38ccd..3a004793d12c3 100644 --- a/tests/ui/try-block/try-block-unused-delims.fixed +++ b/tests/ui/try-block/try-block-unused-delims.current.fixed @@ -1,3 +1,6 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver //@ check-pass //@ edition: 2018 //@ run-rustfix diff --git a/tests/ui/try-block/try-block-unused-delims.stderr b/tests/ui/try-block/try-block-unused-delims.current.stderr similarity index 84% rename from tests/ui/try-block/try-block-unused-delims.stderr rename to tests/ui/try-block/try-block-unused-delims.current.stderr index 765cd9c0fc4f6..685357b214b49 100644 --- a/tests/ui/try-block/try-block-unused-delims.stderr +++ b/tests/ui/try-block/try-block-unused-delims.current.stderr @@ -1,11 +1,11 @@ warning: unnecessary parentheses around function argument - --> $DIR/try-block-unused-delims.rs:11:13 + --> $DIR/try-block-unused-delims.rs:14:13 | LL | consume((try {})); | ^ ^ | note: the lint level is defined here - --> $DIR/try-block-unused-delims.rs:6:9 + --> $DIR/try-block-unused-delims.rs:9:9 | LL | #![warn(unused_parens, unused_braces)] | ^^^^^^^^^^^^^ @@ -16,13 +16,13 @@ LL + consume(try {}); | warning: unnecessary braces around function argument - --> $DIR/try-block-unused-delims.rs:14:13 + --> $DIR/try-block-unused-delims.rs:17:13 | LL | consume({ try {} }); | ^^ ^^ | note: the lint level is defined here - --> $DIR/try-block-unused-delims.rs:6:24 + --> $DIR/try-block-unused-delims.rs:9:24 | LL | #![warn(unused_parens, unused_braces)] | ^^^^^^^^^^^^^ @@ -33,7 +33,7 @@ LL + consume(try {}); | warning: unnecessary parentheses around `match` scrutinee expression - --> $DIR/try-block-unused-delims.rs:17:11 + --> $DIR/try-block-unused-delims.rs:20:11 | LL | match (try {}) { | ^ ^ @@ -45,7 +45,7 @@ LL + match try {} { | warning: unnecessary parentheses around `let` scrutinee expression - --> $DIR/try-block-unused-delims.rs:22:22 + --> $DIR/try-block-unused-delims.rs:25:22 | LL | if let Err(()) = (try {}) {} | ^ ^ @@ -57,7 +57,7 @@ LL + if let Err(()) = try {} {} | warning: unnecessary parentheses around `match` scrutinee expression - --> $DIR/try-block-unused-delims.rs:25:11 + --> $DIR/try-block-unused-delims.rs:28:11 | LL | match (try {}) { | ^ ^ diff --git a/tests/ui/try-block/try-block-unused-delims.next.fixed b/tests/ui/try-block/try-block-unused-delims.next.fixed new file mode 100644 index 0000000000000..3a004793d12c3 --- /dev/null +++ b/tests/ui/try-block/try-block-unused-delims.next.fixed @@ -0,0 +1,32 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@ check-pass +//@ edition: 2018 +//@ run-rustfix + +#![feature(try_blocks)] +#![warn(unused_parens, unused_braces)] + +fn consume(_: Result) -> T { todo!() } + +fn main() { + consume(try {}); + //~^ WARN unnecessary parentheses + + consume(try {}); + //~^ WARN unnecessary braces + + match try {} { + //~^ WARN unnecessary parentheses + Ok(()) | Err(()) => (), + } + + if let Err(()) = try {} {} + //~^ WARN unnecessary parentheses + + match try {} { + //~^ WARN unnecessary parentheses + Ok(()) | Err(()) => (), + } +} diff --git a/tests/ui/try-block/try-block-unused-delims.next.stderr b/tests/ui/try-block/try-block-unused-delims.next.stderr new file mode 100644 index 0000000000000..685357b214b49 --- /dev/null +++ b/tests/ui/try-block/try-block-unused-delims.next.stderr @@ -0,0 +1,72 @@ +warning: unnecessary parentheses around function argument + --> $DIR/try-block-unused-delims.rs:14:13 + | +LL | consume((try {})); + | ^ ^ + | +note: the lint level is defined here + --> $DIR/try-block-unused-delims.rs:9:9 + | +LL | #![warn(unused_parens, unused_braces)] + | ^^^^^^^^^^^^^ +help: remove these parentheses + | +LL - consume((try {})); +LL + consume(try {}); + | + +warning: unnecessary braces around function argument + --> $DIR/try-block-unused-delims.rs:17:13 + | +LL | consume({ try {} }); + | ^^ ^^ + | +note: the lint level is defined here + --> $DIR/try-block-unused-delims.rs:9:24 + | +LL | #![warn(unused_parens, unused_braces)] + | ^^^^^^^^^^^^^ +help: remove these braces + | +LL - consume({ try {} }); +LL + consume(try {}); + | + +warning: unnecessary parentheses around `match` scrutinee expression + --> $DIR/try-block-unused-delims.rs:20:11 + | +LL | match (try {}) { + | ^ ^ + | +help: remove these parentheses + | +LL - match (try {}) { +LL + match try {} { + | + +warning: unnecessary parentheses around `let` scrutinee expression + --> $DIR/try-block-unused-delims.rs:25:22 + | +LL | if let Err(()) = (try {}) {} + | ^ ^ + | +help: remove these parentheses + | +LL - if let Err(()) = (try {}) {} +LL + if let Err(()) = try {} {} + | + +warning: unnecessary parentheses around `match` scrutinee expression + --> $DIR/try-block-unused-delims.rs:28:11 + | +LL | match (try {}) { + | ^ ^ + | +help: remove these parentheses + | +LL - match (try {}) { +LL + match try {} { + | + +warning: 5 warnings emitted + diff --git a/tests/ui/try-block/try-block-unused-delims.rs b/tests/ui/try-block/try-block-unused-delims.rs index 0520d1d620f5a..a30f6db57b3c9 100644 --- a/tests/ui/try-block/try-block-unused-delims.rs +++ b/tests/ui/try-block/try-block-unused-delims.rs @@ -1,3 +1,6 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver //@ check-pass //@ edition: 2018 //@ run-rustfix