@@ -10,6 +10,7 @@ use rustc_hir::def_id::DefId;
10
10
use rustc_hir:: { Expr , ExprKind , Param , PatKind , Unsafety } ;
11
11
use rustc_lint:: { LateContext , LateLintPass } ;
12
12
use rustc_middle:: ty:: adjustment:: { Adjust , Adjustment , AutoBorrow } ;
13
+ use rustc_middle:: ty:: binding:: BindingMode ;
13
14
use rustc_middle:: ty:: subst:: Subst ;
14
15
use rustc_middle:: ty:: { self , ClosureKind , Ty , TypeFoldable } ;
15
16
use rustc_session:: { declare_lint_pass, declare_tool_lint} ;
@@ -169,11 +170,18 @@ fn check_inputs(cx: &LateContext<'_>, params: &[Param<'_>], call_args: &[Expr<'_
169
170
if params. len ( ) != call_args. len ( ) {
170
171
return false ;
171
172
}
173
+ let binding_modes = cx. typeck_results ( ) . pat_binding_modes ( ) ;
172
174
std:: iter:: zip ( params, call_args) . all ( |( param, arg) | {
173
175
match param. pat . kind {
174
176
PatKind :: Binding ( _, id, ..) if path_to_local_id ( arg, id) => { } ,
175
177
_ => return false ,
176
178
}
179
+ // checks that parameters are not bound as `ref`
180
+ //dbg!(binding_modes.get(param.pat.hir_id));
181
+ if let Some ( BindingMode :: BindByReference ( _) ) = binding_modes. get ( param. pat . hir_id ) {
182
+ return false ;
183
+ }
184
+
177
185
match * cx. typeck_results ( ) . expr_adjustments ( arg) {
178
186
[ ] => true ,
179
187
[
0 commit comments