@@ -5,6 +5,7 @@ use std::fmt::Write;
5
5
use std:: fs;
6
6
use std:: process:: Command ;
7
7
8
+ /// Descriptions of rustc lint groups.
8
9
static GROUP_DESCRIPTIONS : & [ ( & str , & str ) ] = & [
9
10
( "unused" , "Lints that detect things being declared but not used, or excess syntax" ) ,
10
11
( "rustdoc" , "Rustdoc-specific lints" ) ,
@@ -86,17 +87,27 @@ impl<'a> LintExtractor<'a> {
86
87
result. push_str ( "|-------|-------------|-------|\n " ) ;
87
88
result. push_str ( "| warnings | All lints that are set to issue warnings | See [warn-by-default] for the default set of warnings |\n " ) ;
88
89
for ( group_name, group_lints) in groups {
89
- let description = GROUP_DESCRIPTIONS
90
- . iter ( )
91
- . find ( |( n, _) | n == group_name)
92
- . ok_or_else ( || {
93
- format ! (
90
+ let description = match GROUP_DESCRIPTIONS . iter ( ) . find ( |( n, _) | n == group_name) {
91
+ Some ( ( _, desc) ) => desc,
92
+ None if self . validate => {
93
+ return Err ( format ! (
94
94
"lint group `{}` does not have a description, \
95
- please update the GROUP_DESCRIPTIONS list",
95
+ please update the GROUP_DESCRIPTIONS list in \
96
+ src/tools/lint-docs/src/groups.rs",
96
97
group_name
97
98
)
98
- } ) ?
99
- . 1 ;
99
+ . into ( ) ) ;
100
+ }
101
+ None => {
102
+ eprintln ! (
103
+ "warning: lint group `{}` is missing from the GROUP_DESCRIPTIONS list\n \
104
+ If this is a new lint group, please update the GROUP_DESCRIPTIONS in \
105
+ src/tools/lint-docs/src/groups.rs",
106
+ group_name
107
+ ) ;
108
+ continue ;
109
+ }
110
+ } ;
100
111
to_link. extend ( group_lints) ;
101
112
let brackets: Vec < _ > = group_lints. iter ( ) . map ( |l| format ! ( "[{}]" , l) ) . collect ( ) ;
102
113
write ! ( result, "| {} | {} | {} |\n " , group_name, description, brackets. join( ", " ) )
0 commit comments