@@ -85,7 +85,7 @@ impl Lint {
85
85
86
86
/// Generates the Vec items for `register_lint_group` calls in `clippy_lints/src/lib.rs`.
87
87
#[ must_use]
88
- pub fn gen_lint_group_list ( lints : Vec < Lint > ) -> Vec < String > {
88
+ pub fn gen_lint_group_list ( lints : & [ Lint ] ) -> Vec < String > {
89
89
lints
90
90
. into_iter ( )
91
91
. filter_map ( |l| {
@@ -101,14 +101,14 @@ pub fn gen_lint_group_list(lints: Vec<Lint>) -> Vec<String> {
101
101
102
102
/// Generates the `pub mod module_name` list in `clippy_lints/src/lib.rs`.
103
103
#[ must_use]
104
- pub fn gen_modules_list ( lints : Vec < Lint > ) -> Vec < String > {
104
+ pub fn gen_modules_list ( lints : & [ Lint ] ) -> Vec < String > {
105
105
lints
106
106
. into_iter ( )
107
107
. filter_map ( |l| {
108
108
if l. is_internal ( ) || l. deprecation . is_some ( ) {
109
109
None
110
110
} else {
111
- Some ( l. module )
111
+ Some ( l. module . clone ( ) )
112
112
}
113
113
} )
114
114
. unique ( )
@@ -119,11 +119,10 @@ pub fn gen_modules_list(lints: Vec<Lint>) -> Vec<String> {
119
119
120
120
/// Generates the list of lint links at the bottom of the README
121
121
#[ must_use]
122
- pub fn gen_changelog_lint_list ( lints : Vec < Lint > ) -> Vec < String > {
123
- let mut lint_list_sorted: Vec < Lint > = lints;
124
- lint_list_sorted. sort_by_key ( |l| l. name . clone ( ) ) ;
125
- lint_list_sorted
122
+ pub fn gen_changelog_lint_list ( lints : & [ Lint ] ) -> Vec < String > {
123
+ lints
126
124
. iter ( )
125
+ . sorted_by_key ( |l| l. name . clone ( ) )
127
126
. filter_map ( |l| {
128
127
if l. is_internal ( ) {
129
128
None
@@ -475,7 +474,7 @@ fn test_gen_changelog_lint_list() {
475
474
format!( "[`should_assert_eq`]: {}#should_assert_eq" , DOCS_LINK . to_string( ) ) ,
476
475
format!( "[`should_assert_eq2`]: {}#should_assert_eq2" , DOCS_LINK . to_string( ) ) ,
477
476
] ;
478
- assert_eq ! ( expected, gen_changelog_lint_list( lints) ) ;
477
+ assert_eq ! ( expected, gen_changelog_lint_list( & lints) ) ;
479
478
}
480
479
481
480
#[ test]
@@ -525,7 +524,7 @@ fn test_gen_modules_list() {
525
524
"pub mod another_module;" . to_string( ) ,
526
525
"pub mod module_name;" . to_string( ) ,
527
526
] ;
528
- assert_eq ! ( expected, gen_modules_list( lints) ) ;
527
+ assert_eq ! ( expected, gen_modules_list( & lints) ) ;
529
528
}
530
529
531
530
#[ test]
@@ -541,5 +540,5 @@ fn test_gen_lint_group_list() {
541
540
" LintId::of(&module_name::INTERNAL)," . to_string( ) ,
542
541
" LintId::of(&module_name::SHOULD_ASSERT_EQ)," . to_string( ) ,
543
542
] ;
544
- assert_eq ! ( expected, gen_lint_group_list( lints) ) ;
543
+ assert_eq ! ( expected, gen_lint_group_list( & lints) ) ;
545
544
}
0 commit comments