mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-28 01:34:21 +00:00
Use cargo check instead of cargo rustc
This commit is contained in:
parent
9b10c4be8c
commit
66a98d2658
@ -186,10 +186,13 @@ pub fn main() {
|
||||
let clippy_enabled = env::var("CLIPPY_TESTS")
|
||||
.ok()
|
||||
.map_or(false, |val| val == "true")
|
||||
|| orig_args.iter().any(|s| s == "--emit=metadata");
|
||||
|| orig_args.iter().any(|s| s == "--emit=dep-info,metadata");
|
||||
|
||||
if clippy_enabled {
|
||||
args.extend_from_slice(&["--cfg".to_owned(), r#"feature="cargo-clippy""#.to_owned()]);
|
||||
if let Ok(extra_args) = env::var("CLIPPY_ARGS") {
|
||||
args.extend(extra_args.split("__CLIPPY_HACKERY__").filter(|s| !s.is_empty()).map(str::to_owned));
|
||||
}
|
||||
}
|
||||
|
||||
let mut ccc = ClippyCompilerCalls::new(clippy_enabled);
|
||||
|
18
src/main.rs
18
src/main.rs
@ -175,23 +175,22 @@ pub fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
fn process<I>(old_args: I) -> Result<(), i32>
|
||||
fn process<I>(mut old_args: I) -> Result<(), i32>
|
||||
where
|
||||
I: Iterator<Item = String>,
|
||||
{
|
||||
let mut args = vec!["rustc".to_owned()];
|
||||
let mut args = vec!["check".to_owned()];
|
||||
|
||||
let mut found_dashes = false;
|
||||
for arg in old_args {
|
||||
for arg in old_args.by_ref() {
|
||||
found_dashes |= arg == "--";
|
||||
if found_dashes {
|
||||
break;
|
||||
}
|
||||
args.push(arg);
|
||||
}
|
||||
if !found_dashes {
|
||||
args.push("--".to_owned());
|
||||
}
|
||||
args.push("--emit=metadata".to_owned());
|
||||
args.push("--cfg".to_owned());
|
||||
args.push(r#"feature="cargo-clippy""#.to_owned());
|
||||
|
||||
let clippy_args: String = old_args.map(|arg| format!("{}__CLIPPY_HACKERY__", arg)).collect();
|
||||
|
||||
let mut path = std::env::current_exe()
|
||||
.expect("current executable path invalid")
|
||||
@ -202,6 +201,7 @@ where
|
||||
let exit_status = std::process::Command::new("cargo")
|
||||
.args(&args)
|
||||
.env("RUSTC_WRAPPER", path)
|
||||
.env("CLIPPY_ARGS", clippy_args)
|
||||
.spawn()
|
||||
.expect("could not run cargo")
|
||||
.wait()
|
||||
|
Loading…
Reference in New Issue
Block a user