]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/unit_arg.rs
iterate List by value
[rust.git] / tests / ui / unit_arg.rs
index 2f743f227b893e29b3b38ddbf0d208e296c08203..d90c49f79de623de06b623664d540e3f2498d4d0 100644 (file)
@@ -1,7 +1,6 @@
-#![feature(tool_lints)]
-
+// run-rustfix
 #![warn(clippy::unit_arg)]
-#![allow(clippy::no_effect)]
+#![allow(unused_braces, clippy::no_effect, unused_must_use)]
 
 use std::fmt::Debug;
 
@@ -23,7 +22,9 @@ fn bar<T: Debug>(&self, t: T) {
 
 fn bad() {
     foo({});
-    foo({ 1; });
+    foo({
+        1;
+    });
     foo(foo(1));
     foo({
         foo(1);
@@ -31,7 +32,9 @@ fn bad() {
     });
     foo3({}, 2, 2);
     let b = Bar;
-    b.bar({ 1; });
+    b.bar({
+        1;
+    });
 }
 
 fn ok() {
@@ -51,6 +54,17 @@ fn question_mark() -> Result<(), ()> {
     Ok(())
 }
 
+#[allow(dead_code)]
+mod issue_2945 {
+    fn unit_fn() -> Result<(), i32> {
+        Ok(())
+    }
+
+    fn fallible() -> Result<(), i32> {
+        Ok(unit_fn()?)
+    }
+}
+
 fn main() {
     bad();
     ok();