]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/unit_arg.rs
Auto merge of #68717 - petrochenkov:stabexpat, r=varkor
[rust.git] / tests / ui / unit_arg.rs
index 8f290446b5e42a990fec717fbc0ed1e3a0861773..d90c49f79de623de06b623664d540e3f2498d4d0 100644 (file)
@@ -1,5 +1,6 @@
-#![warn(unit_arg)]
-#![allow(no_effect)]
+// run-rustfix
+#![warn(clippy::unit_arg)]
+#![allow(unused_braces, clippy::no_effect, unused_must_use)]
 
 use std::fmt::Debug;
 
@@ -21,7 +22,9 @@ fn bar<T: Debug>(&self, t: T) {
 
 fn bad() {
     foo({});
-    foo({ 1; });
+    foo({
+        1;
+    });
     foo(foo(1));
     foo({
         foo(1);
@@ -29,7 +32,9 @@ fn bad() {
     });
     foo3({}, 2, 2);
     let b = Bar;
-    b.bar({ 1; });
+    b.bar({
+        1;
+    });
 }
 
 fn ok() {
@@ -49,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();