about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLenny222 <github@kudling.de>2013-05-24 21:32:30 +0200
committerLenny222 <github@kudling.de>2013-05-24 21:32:30 +0200
commit1009c21ad7b1db366a5c600946652cc490598ec1 (patch)
tree088173073f93ea1dd97dacd0fb732f7dd2dde018
parent7c0cc9c47a3d95e058b3684c7ed14924f64ff808 (diff)
downloadrust-1009c21ad7b1db366a5c600946652cc490598ec1.tar.gz
rust-1009c21ad7b1db366a5c600946652cc490598ec1.zip
show options for -W help and -W
-rw-r--r--src/librustc/driver/driver.rs2
-rw-r--r--src/librustc/rustc.rc7
2 files changed, 7 insertions, 2 deletions
diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs
index a7cc90f473d..75731cf4dc6 100644
--- a/src/librustc/driver/driver.rs
+++ b/src/librustc/driver/driver.rs
@@ -811,7 +811,7 @@ pub fn optgroups() -> ~[getopts::groups::OptGroup] {
                           for detail)", "FEATURE"),
   optopt("", "android-cross-path",
          "The path to the Android NDK", "PATH"),
-  optmulti("W", "warn",
+  optflagopt("W", "warn",
                         "Set lint warnings", "OPT"),
   optmulti("A", "allow",
                         "Set lint allowed", "OPT"),
diff --git a/src/librustc/rustc.rc b/src/librustc/rustc.rc
index 2b392efaa85..056b4a9a49e 100644
--- a/src/librustc/rustc.rc
+++ b/src/librustc/rustc.rc
@@ -228,9 +228,14 @@ pub fn run_compiler(args: &~[~str], demitter: diagnostic::Emitter) {
         return;
     }
 
+    // Display the available lint options if "-W help" or only "-W" is given.
     let lint_flags = vec::append(getopts::opt_strs(matches, "W"),
                                  getopts::opt_strs(matches, "warn"));
-    if lint_flags.contains(&~"help") {
+
+    let show_lint_options = lint_flags.contains(&~"help") ||
+        (opt_present(matches, "W") && lint_flags.is_empty());
+
+    if show_lint_options {
         describe_warnings();
         return;
     }