Skip to content

Commit df2d3c8

Browse files
committed
check for unstable options
1 parent 7c479fd commit df2d3c8

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

src/main.rs

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,36 @@ where
5858
{
5959
let mut args = vec!["check".to_owned()];
6060

61+
let mut fix = false;
62+
let mut unstable_options = false;
63+
6164
for arg in old_args.by_ref() {
62-
if arg == "--fix" {
63-
args[0] = "fix".to_owned();
64-
continue;
65+
match arg {
66+
"--fix" => {
67+
fix = true;
68+
continue;
69+
},
70+
"--" => break,
71+
// Cover -Zunstable-options and -Z unstable-options
72+
s if s.ends_with("unstable-options") => unstable_options = true,
73+
_ => {},
6574
}
6675

67-
if arg == "--" {
68-
break;
69-
}
7076
args.push(arg);
7177
}
7278

79+
if fix && !unstable_options {
80+
panic!("Usage of `--fix` requires `-Z unstable-options`");
81+
} else {
82+
args[0] = "fix".to_owned();
83+
}
84+
85+
let env_name = if unstable_options {
86+
"RUSTC_WORKSPACE_WRAPPER"
87+
} else {
88+
"RUSTC_WRAPPER"
89+
};
90+
7391
let clippy_args: String = old_args.map(|arg| format!("{}__CLIPPY_HACKERY__", arg)).collect();
7492

7593
let mut path = std::env::current_exe()

0 commit comments

Comments
 (0)