Skip to content

Add mention of warnings lint group to help message #30728

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 7, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/librustc_driver/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -632,6 +633,8 @@ Available lint options:
.map(|&(s, _)| s.chars().count())
.max()
.unwrap_or(0);
let max_name_len = std::cmp::max(max_name_len, "warnings".len());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just max here since you imported it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, okay! I should review how importing modules works. I had tried cmp::max and that gave me a compiler error, but std::cmp::max compiled so I went with that.


let padded = |x: &str| {
let mut s = repeat(" ")
.take(max_name_len - x.chars().count())
Expand All @@ -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 {
Expand Down