]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/let_if_seq.rs
Auto merge of #68717 - petrochenkov:stabexpat, r=varkor
[rust.git] / tests / ui / let_if_seq.rs
index 102b72f3e253458ba7ef076f467b231f65e0549c..802beeb4be6b18360bd5f6e59defababa1319c74 100644 (file)
@@ -1,11 +1,17 @@
-#![feature(tool_lints)]
-
-
-#![allow(unused_variables, unused_assignments, clippy::similar_names, clippy::blacklisted_name)]
+#![allow(
+    unused_variables,
+    unused_assignments,
+    clippy::similar_names,
+    clippy::blacklisted_name
+)]
 #![warn(clippy::useless_let_if_seq)]
 
-fn f() -> bool { true }
-fn g(x: i32) -> i32 { x + 1 }
+fn f() -> bool {
+    true
+}
+fn g(x: i32) -> i32 {
+    x + 1
+}
 
 fn issue985() -> i32 {
     let mut x = 42;
@@ -63,8 +69,7 @@ fn main() {
     if f() {
         f();
         bar = 42;
-    }
-    else {
+    } else {
         f();
     }
 
@@ -103,4 +108,12 @@ fn main() {
     }
 
     baz = 1337;
+
+    // issue 3043 - types with interior mutability should not trigger this lint
+    use std::cell::Cell;
+    let mut val = Cell::new(1);
+    if true {
+        val = Cell::new(2);
+    }
+    println!("{}", val.get());
 }