@@ -43,7 +43,7 @@ declare_clippy_lint! {
43
43
"missed shortcircuit opportunity on collect"
44
44
}
45
45
46
- #[ derive( Clone ) ]
46
+ #[ derive( Clone , Default ) ]
47
47
pub struct Pass {
48
48
// To ensure that we do not lint the same expression more than once
49
49
seen_expr_nodes : HashSet < NodeId > ,
@@ -69,7 +69,7 @@ struct Suggestion {
69
69
70
70
fn format_suggestion_pattern < ' a , ' tcx > (
71
71
cx : & LateContext < ' a , ' tcx > ,
72
- collection_ty : TypeVariants ,
72
+ collection_ty : & TypeVariants ,
73
73
is_option : bool ,
74
74
) -> String {
75
75
let collection_pat = match collection_ty {
@@ -125,13 +125,13 @@ fn check_expr_for_collect<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr
125
125
126
126
return if match_type( cx, normal_ty, & paths:: OPTION ) {
127
127
Some ( Suggestion {
128
- pattern: format_suggestion_pattern( cx, collect_ty. sty. clone( ) , true ) ,
128
+ pattern: format_suggestion_pattern( cx, & collect_ty. sty. clone( ) , true ) ,
129
129
type_colloquial: "Option" ,
130
130
success_variant: "Some" ,
131
131
} )
132
132
} else if match_type( cx, normal_ty, & paths:: RESULT ) {
133
133
Some ( Suggestion {
134
- pattern: format_suggestion_pattern( cx, collect_ty. sty. clone( ) , false ) ,
134
+ pattern: format_suggestion_pattern( cx, & collect_ty. sty. clone( ) , false ) ,
135
135
type_colloquial: "Result" ,
136
136
success_variant: "Ok" ,
137
137
} )
0 commit comments