]> git.proxmox.com Git - cargo.git/commitdiff
Better fmt for file body
authorhi-rustin <rustin.liu@gmail.com>
Sat, 21 Aug 2021 15:54:59 +0000 (23:54 +0800)
committerhi-rustin <rustin.liu@gmail.com>
Sat, 21 Aug 2021 15:54:59 +0000 (23:54 +0800)
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
tests/testsuite/fix.rs

index 7e20fdd3f250fac8e1d032a65eaa51b6c7291ef5..b5f067555269e2ec98150b15d29f5060223808c6 100644 (file)
@@ -1691,41 +1691,41 @@ fn fix_with_run_cargo_in_proc_macros() {
         .file(
             "Cargo.toml",
             r#"
-                    [package]
-                    name = "foo"
-                    version = "0.1.0"
-                    edition = "2018"
+                [package]
+                name = "foo"
+                version = "0.1.0"
+                edition = "2018"
 
-                    [lib]
-                    proc-macro = true
-                "#,
+                [lib]
+                proc-macro = true
+            "#,
         )
         .file(
             "src/lib.rs",
             r#"
-                    use proc_macro::*;
+                use proc_macro::*;
     
-                    #[proc_macro]
-                    pub fn foo(_input: TokenStream) -> TokenStream {
-                        let output = std::process::Command::new("cargo")
-                            .args(&["metadata", "--format-version=1"])
-                            .output()
-                            .unwrap();
-                        eprintln!("{}", std::str::from_utf8(&output.stderr).unwrap());
-                        println!("{}", std::str::from_utf8(&output.stdout).unwrap());
-                        "".parse().unwrap()
-                    }                    
-                "#,
+                #[proc_macro]
+                pub fn foo(_input: TokenStream) -> TokenStream {
+                    let output = std::process::Command::new("cargo")
+                        .args(&["metadata", "--format-version=1"])
+                        .output()
+                        .unwrap();
+                    eprintln!("{}", std::str::from_utf8(&output.stderr).unwrap());
+                    println!("{}", std::str::from_utf8(&output.stdout).unwrap());
+                    "".parse().unwrap()
+                }                    
+            "#,
         )
         .file(
             "src/bin/main.rs",
             r#"
-            use foo::foo;
+                use foo::foo;
 
-            fn main() {
-                foo!("bar")
-            }
-        "#,
+                fn main() {
+                    foo!("bar")
+                }
+            "#,
         )
         .build();
     p.cargo("fix --allow-no-vcs")