@@ -10,6 +10,7 @@ use rustc_hir::def_id::DefId;
1010use rustc_hir:: { Expr , ExprKind , Param , PatKind , Unsafety } ;
1111use rustc_lint:: { LateContext , LateLintPass } ;
1212use rustc_middle:: ty:: adjustment:: { Adjust , Adjustment , AutoBorrow } ;
13+ use rustc_middle:: ty:: binding:: BindingMode ;
1314use rustc_middle:: ty:: subst:: Subst ;
1415use rustc_middle:: ty:: { self , ClosureKind , Ty , TypeFoldable } ;
1516use rustc_session:: { declare_lint_pass, declare_tool_lint} ;
@@ -169,11 +170,18 @@ fn check_inputs(cx: &LateContext<'_>, params: &[Param<'_>], call_args: &[Expr<'_
169170 if params. len ( ) != call_args. len ( ) {
170171 return false ;
171172 }
173+ let binding_modes = cx. typeck_results ( ) . pat_binding_modes ( ) ;
172174 std:: iter:: zip ( params, call_args) . all ( |( param, arg) | {
173175 match param. pat . kind {
174176 PatKind :: Binding ( _, id, ..) if path_to_local_id ( arg, id) => { } ,
175177 _ => return false ,
176178 }
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+
177185 match * cx. typeck_results ( ) . expr_adjustments ( arg) {
178186 [ ] => true ,
179187 [
0 commit comments