]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/let_if_seq.rs
iterate List by value
[rust.git] / tests / ui / let_if_seq.rs
index 9e221cc5bc23b8fa82b686f1771b94b2e0f5fb86..802beeb4be6b18360bd5f6e59defababa1319c74 100644 (file)
@@ -1,11 +1,17 @@
-#![feature(plugin)]
-#![plugin(clippy)]
-
-#![allow(unused_variables, unused_assignments, similar_names, blacklisted_name)]
-#![deny(useless_let_if_seq)]
-
-fn f() -> bool { true }
-fn g(x: i32) -> i32 { x + 1 }
+#![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 issue985() -> i32 {
     let mut x = 42;
@@ -55,30 +61,19 @@ fn main() {
     issue985_alt();
 
     let mut foo = 0;
-
-
-
     if f() {
         foo = 42;
     }
 
     let mut bar = 0;
-
-
-
     if f() {
         f();
         bar = 42;
-    }
-    else {
+    } else {
         f();
     }
 
     let quz;
-
-
-
-
     if f() {
         quz = 42;
     } else {
@@ -87,7 +82,6 @@ fn main() {
 
     // `toto` is used several times
     let mut toto;
-
     if f() {
         toto = 42;
     } else {
@@ -109,12 +103,17 @@ fn main() {
 
     // baz needs to be mut
     let mut baz = 0;
-
-
-
     if f() {
         baz = 42;
     }
 
     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());
 }