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?
This commit is contained in:
commit
2edb1d9b96
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user