@@ -5,6 +5,7 @@ use std::fmt::Write;
55use std:: fs;
66use std:: process:: Command ;
77
8+ /// Descriptions of rustc lint groups.
89static GROUP_DESCRIPTIONS : & [ ( & str , & str ) ] = & [
910 ( "unused" , "Lints that detect things being declared but not used, or excess syntax" ) ,
1011 ( "rustdoc" , "Rustdoc-specific lints" ) ,
@@ -86,17 +87,27 @@ impl<'a> LintExtractor<'a> {
8687 result. push_str ( "|-------|-------------|-------|\n " ) ;
8788 result. push_str ( "| warnings | All lints that are set to issue warnings | See [warn-by-default] for the default set of warnings |\n " ) ;
8889 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 ! (
9494 "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",
9697 group_name
9798 )
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+ } ;
100111 to_link. extend ( group_lints) ;
101112 let brackets: Vec < _ > = group_lints. iter ( ) . map ( |l| format ! ( "[{}]" , l) ) . collect ( ) ;
102113 write ! ( result, "| {} | {} | {} |\n " , group_name, description, brackets. join( ", " ) )
0 commit comments