File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -495,7 +495,7 @@ 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( ) ) ;
500500 if let Some ( info) = declared_lints:: LINTS . iter ( ) . find ( |info| info. lint . name == target) {
501501 println ! ( "{}" , info. explanation) ;
@@ -512,8 +512,10 @@ pub fn explain(name: &str) {
512512 println ! ( " - {}: {} (default: {})" , conf. name, conf. doc, conf. default ) ;
513513 }
514514 }
515+ 0
515516 } else {
516517 println ! ( "unknown lint: {name}" ) ;
518+ 1
517519 }
518520}
519521
Original file line number Diff line number Diff line change @@ -57,7 +57,9 @@ pub fn main() {
5757 if let Some ( pos) = env:: args ( ) . position ( |a| a == "--explain" ) {
5858 if let Some ( mut lint) = env:: args ( ) . nth ( pos + 1 ) {
5959 lint. make_ascii_lowercase ( ) ;
60- clippy_lints:: explain ( & lint. strip_prefix ( "clippy::" ) . unwrap_or ( & lint) . replace ( '-' , "_" ) ) ;
60+ process:: exit ( clippy_lints:: explain (
61+ & lint. strip_prefix ( "clippy::" ) . unwrap_or ( & lint) . replace ( '-' , "_" ) ,
62+ ) ) ;
6163 } else {
6264 show_help ( ) ;
6365 }
You can’t perform that action at this time.
0 commit comments