@@ -79,25 +79,19 @@ fn check_arguments<'tcx>(
7979 name : & str ,
8080 fn_kind : & str ,
8181) {
82- match type_definition. kind ( ) {
83- ty:: FnDef ( ..) | ty:: FnPtr ( ..) => {
84- let parameters = type_definition. fn_sig ( cx. tcx ) . skip_binder ( ) . inputs ( ) ;
85- for ( argument, parameter) in iter:: zip ( arguments, parameters) {
86- match parameter. kind ( ) {
87- ty:: Ref ( _, _, Mutability :: Not ) | ty:: RawPtr ( _, Mutability :: Not ) => {
88- if let ExprKind :: AddrOf ( BorrowKind :: Ref , Mutability :: Mut , _) = argument. kind {
89- span_lint (
90- cx,
91- UNNECESSARY_MUT_PASSED ,
92- argument. span ,
93- format ! ( "the {fn_kind} `{name}` doesn't need a mutable reference" ) ,
94- ) ;
95- }
96- } ,
97- _ => ( ) ,
98- }
82+ if let ty:: FnDef ( ..) | ty:: FnPtr ( ..) = type_definition. kind ( ) {
83+ let parameters = type_definition. fn_sig ( cx. tcx ) . skip_binder ( ) . inputs ( ) ;
84+ for ( argument, parameter) in iter:: zip ( arguments, parameters) {
85+ if let ty:: Ref ( _, _, Mutability :: Not ) | ty:: RawPtr ( _, Mutability :: Not ) = parameter. kind ( )
86+ && let ExprKind :: AddrOf ( BorrowKind :: Ref , Mutability :: Mut , _) = argument. kind
87+ {
88+ span_lint (
89+ cx,
90+ UNNECESSARY_MUT_PASSED ,
91+ argument. span ,
92+ format ! ( "the {fn_kind} `{name}` doesn't need a mutable reference" ) ,
93+ ) ;
9994 }
100- } ,
101- _ => ( ) ,
95+ }
10296 }
10397}
0 commit comments