@@ -125,9 +125,17 @@ Available lint options:
125
125
"
126
126
) ;
127
127
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
+
128
136
let mut lints: Vec < _ > = ALL_LINTS . iter ( ) . collect ( ) ;
129
137
// 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 ) ) ;
131
139
132
140
let max_name_len = lints
133
141
. iter ( )
@@ -153,7 +161,7 @@ Available lint options:
153
161
let print_lints = |lints : & [ & Lint ] | {
154
162
for lint in lints {
155
163
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) ;
157
165
}
158
166
println ! ( "\n " ) ;
159
167
} ;
@@ -179,12 +187,12 @@ Available lint options:
179
187
println ! ( "Lint groups provided by rustc:\n " ) ;
180
188
println ! ( " {} sub-lints" , padded( "name" ) ) ;
181
189
println ! ( " {} ---------" , padded( "----" ) ) ;
182
- // println!(" {} all lints that are set to issue warnings", padded("warnings"));
183
190
184
191
let print_lint_groups = || {
185
192
for group in lint_groups {
186
193
let name = group. to_lowercase ( ) . replace ( "_" , "-" ) ;
187
- let desc = lints. iter ( )
194
+ let desc = lints
195
+ . iter ( )
188
196
. filter ( |& lint| lint. group == group)
189
197
. map ( |lint| lint. name )
190
198
. map ( |name| name. replace ( "_" , "-" ) )
@@ -196,27 +204,6 @@ Available lint options:
196
204
} ;
197
205
198
206
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
- // }
220
207
}
221
208
222
209
fn display_help ( ) {
0 commit comments