File tree 2 files changed +21
-19
lines changed
2 files changed +21
-19
lines changed Original file line number Diff line number Diff line change @@ -78,26 +78,28 @@ pub fn gen_changelog_lint_list(lints: Vec<Lint>) -> Vec<String> {
78
78
lint_list_sorted. sort_by_key ( |l| l. name . clone ( ) ) ;
79
79
lint_list_sorted
80
80
. iter ( )
81
- . filter ( |l| !l. is_internal ( ) )
82
- . map ( |l| {
83
- format ! ( "[`{}`]: {}#{}" , l. name, DOCS_LINK . clone( ) , l. name)
84
- } )
85
- . collect ( )
81
+ . filter_map ( |l| {
82
+ if l. is_internal ( ) {
83
+ None
84
+ } else {
85
+ Some ( format ! ( "[`{}`]: {}#{}" , l. name, DOCS_LINK . clone( ) , l. name) )
86
+ }
87
+ } ) . collect ( )
86
88
}
87
89
88
- /// Generates the ' register_removed' code in `./clippy_lints/src/lib.rs`.
89
- pub fn gen_deprecated ( lints : Vec < Lint > ) -> Vec < String > {
90
+ /// Generates the ` register_removed` code in `./clippy_lints/src/lib.rs`.
91
+ pub fn gen_deprecated ( lints : & [ Lint ] ) -> Vec < String > {
90
92
lints. iter ( )
91
- . filter ( |l| l . deprecation . is_some ( ) )
92
- . map ( |l | {
93
- format ! (
94
- r#" store.register_removed (
95
- "{} ",
96
- "{}" ,
97
- );"# ,
98
- l . name ,
99
- l . deprecation . clone ( ) . unwrap ( )
100
- )
93
+ . filter_map ( |l| {
94
+ l . clone ( ) . deprecation . and_then ( |depr_text | {
95
+ Some (
96
+ format ! (
97
+ " store.register_removed( \n \" {} \" , \n \" {} \" , \n ); ",
98
+ l . name ,
99
+ depr_text
100
+ )
101
+ )
102
+ } )
101
103
} )
102
104
. collect ( )
103
105
}
@@ -352,5 +354,5 @@ fn test_gen_deprecated() {
352
354
"has been superseeded by should_assert_eq2",
353
355
);"# . to_string( )
354
356
] ;
355
- assert_eq ! ( expected, gen_deprecated( lints) ) ;
357
+ assert_eq ! ( expected, gen_deprecated( & lints) ) ;
356
358
}
Original file line number Diff line number Diff line change @@ -88,6 +88,6 @@ fn update_lints() {
88
88
"begin deprecated lints" ,
89
89
"end deprecated lints" ,
90
90
false ,
91
- || { gen_deprecated ( lint_list. clone ( ) ) }
91
+ || { gen_deprecated ( & lint_list) }
92
92
) ;
93
93
}
You can’t perform that action at this time.
0 commit comments