]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/let_if_seq.rs
Rollup merge of #92849 - flip1995:clippyup, r=Manishearth
[rust.git] / tests / ui / let_if_seq.rs
index 9e221cc5bc23b8fa82b686f1771b94b2e0f5fb86..c5cb2eb1fe1c2e66a727e317a0a13ffa169b8df2 100644 (file)
@@ -1,11 +1,19 @@
-#![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,
+    clippy::branches_sharing_code,
+    clippy::needless_late_init
+)]
+#![warn(clippy::useless_let_if_seq)]
+
+fn f() -> bool {
+    true
+}
+fn g(x: i32) -> i32 {
+    x + 1
+}
 
 fn issue985() -> i32 {
     let mut x = 42;
@@ -27,6 +35,7 @@ fn issue985_alt() -> i32 {
     x
 }
 
+#[allow(clippy::manual_strip)]
 fn issue975() -> String {
     let mut udn = "dummy".to_string();
     if udn.starts_with("uuid:") {
@@ -55,30 +64,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 +85,6 @@ fn main() {
 
     // `toto` is used several times
     let mut toto;
-
     if f() {
         toto = 42;
     } else {
@@ -109,12 +106,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());
 }