]> git.proxmox.com Git - rustc.git/blobdiff - src/tools/clippy/tests/ui/needless_late_init.fixed
New upstream version 1.70.0+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / needless_late_init.fixed
index 17f2227ba91c450d4cdf672f134e477bdd68e81a..86d899bb46c361bc2856f1ffc18c24249470d2ea 100644 (file)
@@ -1,4 +1,5 @@
 // run-rustfix
+// aux-build:proc_macros.rs
 #![feature(let_chains)]
 #![allow(unused)]
 #![allow(
@@ -10,6 +11,8 @@
     clippy::uninlined_format_args
 )]
 
+extern crate proc_macros;
+
 use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
 use std::rc::Rc;
 
@@ -138,6 +141,7 @@ const fn in_const() -> &'static str {
     a
 }
 
+#[proc_macros::inline_macros]
 fn does_not_lint() {
     let z;
     if false {
@@ -195,35 +199,27 @@ fn does_not_lint() {
     }
     y = 3;
 
-    macro_rules! assign {
-        ($i:ident) => {
-            $i = 1;
-        };
-    }
     let x;
-    assign!(x);
+    inline!($x = 1;);
 
     let x;
     if true {
-        assign!(x);
+        inline!($x = 1;);
     } else {
         x = 2;
     }
 
-    macro_rules! in_macro {
-        () => {
-            let x;
-            x = 1;
+    inline!({
+        let x;
+        x = 1;
 
-            let x;
-            if true {
-                x = 1;
-            } else {
-                x = 2;
-            }
-        };
-    }
-    in_macro!();
+        let x;
+        if true {
+            x = 1;
+        } else {
+            x = 2;
+        }
+    });
 
     // ignore if-lets - https://github.com/rust-lang/rust-clippy/issues/8613
     let x;