Skip to content

Commit 9c0ae2a

Browse files
committed
Auto merge of #6687 - ehuss:stabilize-wrapper, r=flip1995
Stabilize workspace wrapper. This fixes it so that `cargo clippy` doesn't share the same cache artifacts as `cargo check`. The Cargo side was stabilized a while ago (rust-lang/cargo#8976), so this should be ready to go. I'm not aware of any blockers or concerns. Closes #4612 --- changelog: `cargo clippy` no longer shares the same build cache as `cargo check`.
2 parents 0e371b8 + 0585c34 commit 9c0ae2a

File tree

1 file changed

+1
-23
lines changed

1 file changed

+1
-23
lines changed

src/main.rs

+1-23
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ pub fn main() {
5959
}
6060

6161
struct ClippyCmd {
62-
unstable_options: bool,
6362
cargo_subcommand: &'static str,
6463
args: Vec<String>,
6564
clippy_args: Vec<String>,
@@ -105,21 +104,12 @@ impl ClippyCmd {
105104
}
106105

107106
ClippyCmd {
108-
unstable_options,
109107
cargo_subcommand,
110108
args,
111109
clippy_args,
112110
}
113111
}
114112

115-
fn path_env(&self) -> &'static str {
116-
if self.unstable_options {
117-
"RUSTC_WORKSPACE_WRAPPER"
118-
} else {
119-
"RUSTC_WRAPPER"
120-
}
121-
}
122-
123113
fn path() -> PathBuf {
124114
let mut path = env::current_exe()
125115
.expect("current executable path invalid")
@@ -156,7 +146,7 @@ impl ClippyCmd {
156146
.map(|arg| format!("{}__CLIPPY_HACKERY__", arg))
157147
.collect();
158148

159-
cmd.env(self.path_env(), Self::path())
149+
cmd.env("RUSTC_WORKSPACE_WRAPPER", Self::path())
160150
.envs(ClippyCmd::target_dir())
161151
.env("CLIPPY_ARGS", clippy_args)
162152
.arg(self.cargo_subcommand)
@@ -205,7 +195,6 @@ mod tests {
205195
.map(ToString::to_string);
206196
let cmd = ClippyCmd::new(args);
207197
assert_eq!("fix", cmd.cargo_subcommand);
208-
assert_eq!("RUSTC_WORKSPACE_WRAPPER", cmd.path_env());
209198
assert!(cmd.args.iter().any(|arg| arg.ends_with("unstable-options")));
210199
}
211200

@@ -232,16 +221,5 @@ mod tests {
232221
let args = "cargo clippy".split_whitespace().map(ToString::to_string);
233222
let cmd = ClippyCmd::new(args);
234223
assert_eq!("check", cmd.cargo_subcommand);
235-
assert_eq!("RUSTC_WRAPPER", cmd.path_env());
236-
}
237-
238-
#[test]
239-
fn check_unstable() {
240-
let args = "cargo clippy -Zunstable-options"
241-
.split_whitespace()
242-
.map(ToString::to_string);
243-
let cmd = ClippyCmd::new(args);
244-
assert_eq!("check", cmd.cargo_subcommand);
245-
assert_eq!("RUSTC_WORKSPACE_WRAPPER", cmd.path_env());
246224
}
247225
}

0 commit comments

Comments
 (0)