summaryrefslogtreecommitdiffstats
path: root/tests/ui/lint/unused/must-use-block-expr.fixed
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/lint/unused/must-use-block-expr.fixed')
-rw-r--r--tests/ui/lint/unused/must-use-block-expr.fixed36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/ui/lint/unused/must-use-block-expr.fixed b/tests/ui/lint/unused/must-use-block-expr.fixed
new file mode 100644
index 000000000..642012812
--- /dev/null
+++ b/tests/ui/lint/unused/must-use-block-expr.fixed
@@ -0,0 +1,36 @@
+// run-rustfix
+// check-pass
+
+#![warn(unused_must_use)]
+
+#[must_use]
+fn foo() -> i32 {
+ 42
+}
+
+fn bar() {
+ {
+ let _ = foo();
+ //~^ WARN unused return value
+ }
+}
+
+fn baz() {
+ {
+ let _ = foo();
+ //~^ WARN unused return value
+ };
+}
+
+fn main() {
+ bar();
+ baz();
+ {
+ let _ = 1 + 2;
+ //~^ WARN unused arithmetic operation
+ }
+ {
+ let _ = 1 + 2;
+ //~^ WARN unused arithmetic operation
+ };
+}