]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/suspicious_else_formatting.rs
Move MSRV tests into the lint specific test files
[rust.git] / tests / ui / suspicious_else_formatting.rs
index 226010ec6df3a24c63898f53a81c227b8a3781af..21753e5dc6a47c0546f43f6210392062821d9c9a 100644 (file)
@@ -1,4 +1,10 @@
+// aux-build:proc_macro_suspicious_else_formatting.rs
+
 #![warn(clippy::suspicious_else_formatting)]
+#![allow(clippy::if_same_then_else, clippy::let_unit_value)]
+
+extern crate proc_macro_suspicious_else_formatting;
+use proc_macro_suspicious_else_formatting::DeriveBadSpan;
 
 fn foo() -> bool {
     true
@@ -40,6 +46,7 @@ fn main() {
     {
     }
 
+    // This is fine, though weird. Allman style braces on the else.
     if foo() {
     }
     else
@@ -76,4 +83,33 @@ fn main() {
     }
     if foo() {
     }
+
+    // Almost Allman style braces. Lint these.
+    if foo() {
+    }
+
+    else
+    {
+
+    }
+
+    if foo() {
+    }
+    else
+
+    {
+
+    }
+
+    // #3864 - Allman style braces
+    if foo()
+    {
+    }
+    else
+    {
+    }
 }
+
+// #7650 - Don't lint. Proc-macro using bad spans for `if` expressions.
+#[derive(DeriveBadSpan)]
+struct _Foo(u32, u32);