summaryrefslogtreecommitdiffstats
path: root/src/test/ui/try-block/try-block-unused-delims.fixed
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/try-block/try-block-unused-delims.fixed')
-rw-r--r--src/test/ui/try-block/try-block-unused-delims.fixed29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/test/ui/try-block/try-block-unused-delims.fixed b/src/test/ui/try-block/try-block-unused-delims.fixed
new file mode 100644
index 000000000..756081738
--- /dev/null
+++ b/src/test/ui/try-block/try-block-unused-delims.fixed
@@ -0,0 +1,29 @@
+// check-pass
+// compile-flags: --edition 2018
+// run-rustfix
+
+#![feature(try_blocks)]
+#![warn(unused_parens, unused_braces)]
+
+fn consume<T>(_: Result<T, T>) -> 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(()) => (),
+ }
+}