]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/unnecessary_wraps.rs
Auto merge of #9684 - kraktus:ref_option_ref, r=xFrednet
[rust.git] / tests / ui / unnecessary_wraps.rs
index a510263e67da19a2256975ffe18767606dffae0c..63648ef5826f6e1f2c5009050393c4b884e9a735 100644 (file)
@@ -22,29 +22,17 @@ fn func2(a: bool, b: bool) -> Option<i32> {
     if a && b {
         return Some(10);
     }
-    if a {
-        Some(20)
-    } else {
-        Some(30)
-    }
+    if a { Some(20) } else { Some(30) }
 }
 
 // public fns should not be linted
 pub fn func3(a: bool) -> Option<i32> {
-    if a {
-        Some(1)
-    } else {
-        Some(1)
-    }
+    if a { Some(1) } else { Some(1) }
 }
 
 // should not be linted
 fn func4(a: bool) -> Option<i32> {
-    if a {
-        Some(1)
-    } else {
-        None
-    }
+    if a { Some(1) } else { None }
 }
 
 // should be linted
@@ -64,11 +52,7 @@ fn func7() -> Result<i32, ()> {
 
 // should not be linted
 fn func8(a: bool) -> Result<i32, ()> {
-    if a {
-        Ok(1)
-    } else {
-        Err(())
-    }
+    if a { Ok(1) } else { Err(()) }
 }
 
 // should not be linted
@@ -81,7 +65,7 @@ fn func10() -> Option<()> {
     unimplemented!()
 }
 
-struct A;
+pub struct A;
 
 impl A {
     // should not be linted
@@ -143,20 +127,12 @@ fn issue_6640_2(a: bool, b: bool) -> Result<(), i32> {
 
 // should not be linted
 fn issue_6640_3() -> Option<()> {
-    if true {
-        Some(())
-    } else {
-        None
-    }
+    if true { Some(()) } else { None }
 }
 
 // should not be linted
 fn issue_6640_4() -> Result<(), ()> {
-    if true {
-        Ok(())
-    } else {
-        Err(())
-    }
+    if true { Ok(()) } else { Err(()) }
 }
 
 fn main() {