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 {
495
495
explanation : & ' static str ,
496
496
}
497
497
498
- pub fn explain ( name : & str ) {
498
+ pub fn explain ( name : & str ) -> i32 {
499
499
let target = format ! ( "clippy::{}" , name. to_ascii_uppercase( ) ) ;
500
500
if let Some ( info) = declared_lints:: LINTS . iter ( ) . find ( |info| info. lint . name == target) {
501
501
println ! ( "{}" , info. explanation) ;
@@ -512,8 +512,10 @@ pub fn explain(name: &str) {
512
512
println ! ( " - {}: {} (default: {})" , conf. name, conf. doc, conf. default ) ;
513
513
}
514
514
}
515
+ 0
515
516
} else {
516
517
println ! ( "unknown lint: {name}" ) ;
518
+ 1
517
519
}
518
520
}
519
521
Original file line number Diff line number Diff line change @@ -57,7 +57,9 @@ pub fn main() {
57
57
if let Some ( pos) = env:: args ( ) . position ( |a| a == "--explain" ) {
58
58
if let Some ( mut lint) = env:: args ( ) . nth ( pos + 1 ) {
59
59
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
+ ) ) ;
61
63
} else {
62
64
show_help ( ) ;
63
65
}
You can’t perform that action at this time.
0 commit comments