From 6c8dd522dfcde0f6f799120dd60b28278ea7d628 Mon Sep 17 00:00:00 2001 From: Mike Anderson Date: Mon, 4 Jan 2016 10:54:30 -0600 Subject: [PATCH 1/2] Add mention of warnings lint group to help message --- src/librustc_driver/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 210b1a26c21..99d30f3bcfb 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}; @@ -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()); + 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)>| { for (name, to) in lints { From 5038d4e8efc32a4d1e6ed215284f494930ba2a19 Mon Sep 17 00:00:00 2001 From: Mike Anderson Date: Wed, 6 Jan 2016 00:42:19 -0600 Subject: [PATCH 2/2] std::cmp::max -> max --- src/librustc_driver/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 99d30f3bcfb..7b8970876f6 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -628,12 +628,12 @@ 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 = std::cmp::max(max_name_len, "warnings".len()); + 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(" ")