@@ -163,8 +163,7 @@ fn check_replace_with_uninit(cx: &LateContext<'_>, src: &Expr<'_>, dest: &Expr<'
163163 }
164164
165165 if_chain ! {
166- if let ExprKind :: Call ( repl_func, repl_args) = src. kind;
167- if repl_args. is_empty( ) ;
166+ if let ExprKind :: Call ( repl_func, [ ] ) = src. kind;
168167 if let ExprKind :: Path ( ref repl_func_qpath) = repl_func. kind;
169168 if let Some ( repl_def_id) = cx. qpath_res( repl_func_qpath, repl_func. hir_id) . opt_def_id( ) ;
170169 then {
@@ -246,11 +245,10 @@ impl<'tcx> LateLintPass<'tcx> for MemReplace {
246245 fn check_expr ( & mut self , cx : & LateContext < ' tcx > , expr : & ' tcx Expr < ' _ > ) {
247246 if_chain ! {
248247 // Check that `expr` is a call to `mem::replace()`
249- if let ExprKind :: Call ( func, func_args ) = expr. kind;
248+ if let ExprKind :: Call ( func, [ dest , src ] ) = expr. kind;
250249 if let ExprKind :: Path ( ref func_qpath) = func. kind;
251250 if let Some ( def_id) = cx. qpath_res( func_qpath, func. hir_id) . opt_def_id( ) ;
252251 if cx. tcx. is_diagnostic_item( sym:: mem_replace, def_id) ;
253- if let [ dest, src] = func_args;
254252 then {
255253 check_replace_option_with_none( cx, src, dest, expr. span) ;
256254 check_replace_with_uninit( cx, src, dest, expr. span) ;
0 commit comments