@@ -495,26 +495,27 @@ pub(crate) struct LintInfo {
495495 explanation : & ' static str ,
496496}
497497
498- pub fn explain ( name : & str ) {
498+ pub fn explain ( name : & str ) -> i32 {
499499 let target = format ! ( "clippy::{}" , name. to_ascii_uppercase( ) ) ;
500- match declared_lints:: LINTS . iter ( ) . find ( |info| info. lint . name == target) {
501- Some ( info) => {
502- println ! ( "{}" , info. explanation) ;
503- // Check if the lint has configuration
504- let mdconf = get_configuration_metadata ( ) ;
505- if let Some ( config_vec_positions) = mdconf
506- . iter ( )
507- . find_all ( |cconf| cconf. lints . contains ( & info. lint . name_lower ( ) [ 8 ..] . to_owned ( ) ) )
508- {
509- // If it has, print it
510- println ! ( "### Configuration for {}:\n " , info. lint. name_lower( ) ) ;
511- for position in config_vec_positions {
512- let conf = & mdconf[ position] ;
513- println ! ( " - {}: {} (default: {})" , conf. name, conf. doc, conf. default ) ;
514- }
500+ if let Some ( info) = declared_lints:: LINTS . iter ( ) . find ( |info| info. lint . name == target) {
501+ println ! ( "{}" , info. explanation) ;
502+ // Check if the lint has configuration
503+ let mdconf = get_configuration_metadata ( ) ;
504+ if let Some ( config_vec_positions) = mdconf
505+ . iter ( )
506+ . find_all ( |cconf| cconf. lints . contains ( & info. lint . name_lower ( ) [ 8 ..] . to_owned ( ) ) )
507+ {
508+ // If it has, print it
509+ println ! ( "### Configuration for {}:\n " , info. lint. name_lower( ) ) ;
510+ for position in config_vec_positions {
511+ let conf = & mdconf[ position] ;
512+ println ! ( " - {}: {} (default: {})" , conf. name, conf. doc, conf. default ) ;
515513 }
516- } ,
517- None => println ! ( "unknown lint: {name}" ) ,
514+ }
515+ 0
516+ } else {
517+ println ! ( "unknown lint: {name}" ) ;
518+ 1
518519 }
519520}
520521
0 commit comments