@@ -125,9 +125,17 @@ Available lint options:
125125"
126126 ) ;
127127
128+ let lint_level = |lint : & Lint | {
129+ LINT_LEVELS
130+ . iter ( )
131+ . find ( |level_mapping| level_mapping. 0 == lint. group )
132+ . map ( |( _, level) | level)
133+ . unwrap ( )
134+ } ;
135+
128136 let mut lints: Vec < _ > = ALL_LINTS . iter ( ) . collect ( ) ;
129137 // The sort doesn't case-fold but it's doubtful we care.
130- lints. sort_by_cached_key ( |x : & & Lint | ( "unknown" , x. name ) ) ;
138+ lints. sort_by_cached_key ( |x : & & Lint | ( lint_level ( x ) , x. name ) ) ;
131139
132140 let max_name_len = lints
133141 . iter ( )
@@ -153,7 +161,7 @@ Available lint options:
153161 let print_lints = |lints : & [ & Lint ] | {
154162 for lint in lints {
155163 let name = lint. name . replace ( "_" , "-" ) ;
156- println ! ( " {} {:7.7} {}" , padded( & scoped( & name) ) , "unknown" , lint. desc) ;
164+ println ! ( " {} {:7.7} {}" , padded( & scoped( & name) ) , lint_level ( lint ) , lint. desc) ;
157165 }
158166 println ! ( "\n " ) ;
159167 } ;
@@ -179,12 +187,12 @@ Available lint options:
179187 println ! ( "Lint groups provided by rustc:\n " ) ;
180188 println ! ( " {} sub-lints" , padded( "name" ) ) ;
181189 println ! ( " {} ---------" , padded( "----" ) ) ;
182- // println!(" {} all lints that are set to issue warnings", padded("warnings"));
183190
184191 let print_lint_groups = || {
185192 for group in lint_groups {
186193 let name = group. to_lowercase ( ) . replace ( "_" , "-" ) ;
187- let desc = lints. iter ( )
194+ let desc = lints
195+ . iter ( )
188196 . filter ( |& lint| lint. group == group)
189197 . map ( |lint| lint. name )
190198 . map ( |name| name. replace ( "_" , "-" ) )
@@ -196,27 +204,6 @@ Available lint options:
196204 } ;
197205
198206 print_lint_groups ( ) ;
199-
200- // print_lint_groups(builtin_groups);
201-
202- // match (loaded_plugins, plugin.len(), plugin_groups.len()) {
203- // (false, 0, _) | (false, _, 0) => {
204- // println!("Compiler plugins can provide additional lints and lint groups. To see a \
205- // listing of these, re-run `rustc -W help` with a crate filename.");
206- // }
207- // (false, ..) => panic!("didn't load lint plugins but got them anyway!"),
208- // (true, 0, 0) => println!("This crate does not load any lint plugins or lint groups."),
209- // (true, l, g) => {
210- // if l > 0 {
211- // println!("Lint checks provided by plugins loaded by this crate:\n");
212- // print_lints(plugin);
213- // }
214- // if g > 0 {
215- // println!("Lint groups provided by plugins loaded by this crate:\n");
216- // print_lint_groups(plugin_groups);
217- // }
218- // }
219- // }
220207}
221208
222209fn display_help ( ) {
0 commit comments