mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Use struct-like syntax in tool_extended!
Using struct-like syntax allows rustfmt to format macro invocations, instead of giving up and ignoring them. Using a separate macro invocation per tool makes the macro slightly simpler, and isolates syntax errors to individual invocations.
This commit is contained in:
parent
725fccda2b
commit
08d70f57e2
@ -1008,14 +1008,15 @@ impl Step for LibcxxVersionTool {
|
||||
|
||||
macro_rules! tool_extended {
|
||||
(
|
||||
$($name:ident,
|
||||
$path:expr,
|
||||
$tool_name:expr,
|
||||
stable = $stable:expr
|
||||
$(,add_bins_to_sysroot = $add_bins_to_sysroot:expr)?
|
||||
;)+) => {
|
||||
$(
|
||||
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
|
||||
$name:ident {
|
||||
path: $path:expr,
|
||||
tool_name: $tool_name:expr,
|
||||
stable: $stable:expr
|
||||
$( , add_bins_to_sysroot: $add_bins_to_sysroot:expr )?
|
||||
$( , )?
|
||||
}
|
||||
) => {
|
||||
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
|
||||
pub struct $name {
|
||||
pub compiler: Compiler,
|
||||
pub target: TargetSelection,
|
||||
@ -1063,7 +1064,6 @@ macro_rules! tool_extended {
|
||||
)
|
||||
}
|
||||
}
|
||||
)+
|
||||
}
|
||||
}
|
||||
|
||||
@ -1109,15 +1109,33 @@ fn run_tool_build_step(
|
||||
}
|
||||
}
|
||||
|
||||
tool_extended!(
|
||||
Cargofmt, "src/tools/rustfmt", "cargo-fmt", stable=true;
|
||||
CargoClippy, "src/tools/clippy", "cargo-clippy", stable=true;
|
||||
Clippy, "src/tools/clippy", "clippy-driver", stable=true, add_bins_to_sysroot = ["clippy-driver", "cargo-clippy"];
|
||||
Miri, "src/tools/miri", "miri", stable=false, add_bins_to_sysroot = ["miri"];
|
||||
CargoMiri, "src/tools/miri/cargo-miri", "cargo-miri", stable=false, add_bins_to_sysroot = ["cargo-miri"];
|
||||
Rls, "src/tools/rls", "rls", stable=true;
|
||||
Rustfmt, "src/tools/rustfmt", "rustfmt", stable=true, add_bins_to_sysroot = ["rustfmt", "cargo-fmt"];
|
||||
);
|
||||
tool_extended!(Cargofmt { path: "src/tools/rustfmt", tool_name: "cargo-fmt", stable: true });
|
||||
tool_extended!(CargoClippy { path: "src/tools/clippy", tool_name: "cargo-clippy", stable: true });
|
||||
tool_extended!(Clippy {
|
||||
path: "src/tools/clippy",
|
||||
tool_name: "clippy-driver",
|
||||
stable: true,
|
||||
add_bins_to_sysroot: ["clippy-driver", "cargo-clippy"]
|
||||
});
|
||||
tool_extended!(Miri {
|
||||
path: "src/tools/miri",
|
||||
tool_name: "miri",
|
||||
stable: false,
|
||||
add_bins_to_sysroot: ["miri"]
|
||||
});
|
||||
tool_extended!(CargoMiri {
|
||||
path: "src/tools/miri/cargo-miri",
|
||||
tool_name: "cargo-miri",
|
||||
stable: false,
|
||||
add_bins_to_sysroot: ["cargo-miri"]
|
||||
});
|
||||
tool_extended!(Rls { path: "src/tools/rls", tool_name: "rls", stable: true });
|
||||
tool_extended!(Rustfmt {
|
||||
path: "src/tools/rustfmt",
|
||||
tool_name: "rustfmt",
|
||||
stable: true,
|
||||
add_bins_to_sysroot: ["rustfmt", "cargo-fmt"]
|
||||
});
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct TestFloatParse {
|
||||
|
Loading…
Reference in New Issue
Block a user