Skip to content

Commit fa67e09

Browse files
committed
auto merge of #6719 : kud1ing/rust/rustc_w, r=bstrie
Fixes #6697
2 parents f5d4ea8 + 1009c21 commit fa67e09

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/librustc/driver/driver.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ pub fn optgroups() -> ~[getopts::groups::OptGroup] {
811811
for detail)", "FEATURE"),
812812
optopt("", "android-cross-path",
813813
"The path to the Android NDK", "PATH"),
814-
optmulti("W", "warn",
814+
optflagopt("W", "warn",
815815
"Set lint warnings", "OPT"),
816816
optmulti("A", "allow",
817817
"Set lint allowed", "OPT"),

src/librustc/rustc.rc

+6-1
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,14 @@ pub fn run_compiler(args: &~[~str], demitter: diagnostic::Emitter) {
228228
return;
229229
}
230230

231+
// Display the available lint options if "-W help" or only "-W" is given.
231232
let lint_flags = vec::append(getopts::opt_strs(matches, "W"),
232233
getopts::opt_strs(matches, "warn"));
233-
if lint_flags.contains(&~"help") {
234+
235+
let show_lint_options = lint_flags.contains(&~"help") ||
236+
(opt_present(matches, "W") && lint_flags.is_empty());
237+
238+
if show_lint_options {
234239
describe_warnings();
235240
return;
236241
}

0 commit comments

Comments
 (0)