Skip to content

Commit 1009c21

Browse files
author
Lenny222
committed
show options for -W help and -W
1 parent 7c0cc9c commit 1009c21

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/librustc/driver/driver.rs

Lines changed: 1 addition & 1 deletion
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

Lines changed: 6 additions & 1 deletion
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)