about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-01-07 08:24:36 +0000
committerbors <bors@rust-lang.org>2016-01-07 08:24:36 +0000
commit2edb1d9b96bdf78ee06b73d37f1382a30bc67882 (patch)
treef2952f6e0fce9494435cd8d29c7e675133e8ac04
parent91b27ec9beb8455426da3efd26dfc9155058f5bd (diff)
parent5038d4e8efc32a4d1e6ed215284f494930ba2a19 (diff)
downloadrust-2edb1d9b96bdf78ee06b73d37f1382a30bc67882.tar.gz
rust-2edb1d9b96bdf78ee06b73d37f1382a30bc67882.zip
Auto merge of #30728 - athaeryn:mention-warning-lint-group, r=Manishearth
Fixes #30203.

This is my first time writing Rust, and I think this code could be a bit better. Any suggestions?
-rw-r--r--src/librustc_driver/lib.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs
index 210b1a26c21..7b8970876f6 100644
--- a/src/librustc_driver/lib.rs
+++ b/src/librustc_driver/lib.rs
@@ -70,6 +70,7 @@ use rustc_metadata::loader;
 use rustc_metadata::cstore::CStore;
 use rustc::util::common::time;
 
+use std::cmp::max;
 use std::cmp::Ordering::Equal;
 use std::env;
 use std::io::{self, Read, Write};
@@ -627,11 +628,13 @@ Available lint options:
 
 
 
-    let max_name_len = plugin_groups.iter()
-                                    .chain(&builtin_groups)
-                                    .map(|&(s, _)| s.chars().count())
-                                    .max()
-                                    .unwrap_or(0);
+    let max_name_len = max("warnings".len(),
+                           plugin_groups.iter()
+                                        .chain(&builtin_groups)
+                                        .map(|&(s, _)| s.chars().count())
+                                        .max()
+                                        .unwrap_or(0));
+
     let padded = |x: &str| {
         let mut s = repeat(" ")
                         .take(max_name_len - x.chars().count())
@@ -643,6 +646,7 @@ Available lint options:
     println!("Lint groups provided by rustc:\n");
     println!("    {}  {}", padded("name"), "sub-lints");
     println!("    {}  {}", padded("----"), "---------");
+    println!("    {}  {}", padded("warnings"), "all built-in lints");
 
     let print_lint_groups = |lints: Vec<(&'static str, Vec<lint::LintId>)>| {
         for (name, to) in lints {