]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/default_numeric_fallback_i32.fixed
Auto merge of #9684 - kraktus:ref_option_ref, r=xFrednet
[rust.git] / tests / ui / default_numeric_fallback_i32.fixed
index bded9e2c0e801723b89547d606120a989078473d..3f4994f0453b1ef153fea0355d2a1130f9adafdc 100644 (file)
@@ -1,12 +1,16 @@
 // run-rustfix
 // aux-build:macro_rules.rs
 
+#![feature(lint_reasons)]
 #![warn(clippy::default_numeric_fallback)]
-#![allow(unused)]
-#![allow(clippy::never_loop)]
-#![allow(clippy::no_effect)]
-#![allow(clippy::unnecessary_operation)]
-#![allow(clippy::branches_sharing_code)]
+#![allow(
+    unused,
+    clippy::never_loop,
+    clippy::no_effect,
+    clippy::unnecessary_operation,
+    clippy::branches_sharing_code,
+    clippy::let_unit_value
+)]
 
 #[macro_use]
 extern crate macro_rules;
@@ -29,6 +33,8 @@ mod basic_expr {
         let x: [i32; 3] = [1, 2, 3];
         let x: (i32, i32) = if true { (1, 2) } else { (3, 4) };
         let x: _ = 1;
+        let x: u64 = 1;
+        const CONST_X: i8 = 1;
     }
 }
 
@@ -55,6 +61,14 @@ mod nested_local {
             // Should NOT lint this because this literal is bound to `_` of outer `Local`.
             2
         };
+
+        const CONST_X: i32 = {
+            // Should lint this because this literal is not bound to any types.
+            let y = 1_i32;
+
+            // Should NOT lint this because this literal is bound to `_` of outer `Local`.
+            1
+        };
     }
 }
 
@@ -170,4 +184,9 @@ mod in_macro {
     }
 }
 
+fn check_expect_suppression() {
+    #[expect(clippy::default_numeric_fallback)]
+    let x = 21;
+}
+
 fn main() {}