Skip to content

Commit 2edb1d9

Browse files
committed
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?
2 parents 91b27ec + 5038d4e commit 2edb1d9

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/librustc_driver/lib.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ use rustc_metadata::loader;
7070
use rustc_metadata::cstore::CStore;
7171
use rustc::util::common::time;
7272

73+
use std::cmp::max;
7374
use std::cmp::Ordering::Equal;
7475
use std::env;
7576
use std::io::{self, Read, Write};
@@ -627,11 +628,13 @@ Available lint options:
627628

628629

629630

630-
let max_name_len = plugin_groups.iter()
631-
.chain(&builtin_groups)
632-
.map(|&(s, _)| s.chars().count())
633-
.max()
634-
.unwrap_or(0);
631+
let max_name_len = max("warnings".len(),
632+
plugin_groups.iter()
633+
.chain(&builtin_groups)
634+
.map(|&(s, _)| s.chars().count())
635+
.max()
636+
.unwrap_or(0));
637+
635638
let padded = |x: &str| {
636639
let mut s = repeat(" ")
637640
.take(max_name_len - x.chars().count())
@@ -643,6 +646,7 @@ Available lint options:
643646
println!("Lint groups provided by rustc:\n");
644647
println!(" {} {}", padded("name"), "sub-lints");
645648
println!(" {} {}", padded("----"), "---------");
649+
println!(" {} {}", padded("warnings"), "all built-in lints");
646650

647651
let print_lint_groups = |lints: Vec<(&'static str, Vec<lint::LintId>)>| {
648652
for (name, to) in lints {

0 commit comments

Comments
 (0)