@@ -163,8 +163,7 @@ fn check_replace_with_uninit(cx: &LateContext<'_>, src: &Expr<'_>, dest: &Expr<'
163
163
}
164
164
165
165
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;
168
167
if let ExprKind :: Path ( ref repl_func_qpath) = repl_func. kind;
169
168
if let Some ( repl_def_id) = cx. qpath_res( repl_func_qpath, repl_func. hir_id) . opt_def_id( ) ;
170
169
then {
@@ -246,11 +245,10 @@ impl<'tcx> LateLintPass<'tcx> for MemReplace {
246
245
fn check_expr ( & mut self , cx : & LateContext < ' tcx > , expr : & ' tcx Expr < ' _ > ) {
247
246
if_chain ! {
248
247
// 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;
250
249
if let ExprKind :: Path ( ref func_qpath) = func. kind;
251
250
if let Some ( def_id) = cx. qpath_res( func_qpath, func. hir_id) . opt_def_id( ) ;
252
251
if cx. tcx. is_diagnostic_item( sym:: mem_replace, def_id) ;
253
- if let [ dest, src] = func_args;
254
252
then {
255
253
check_replace_option_with_none( cx, src, dest, expr. span) ;
256
254
check_replace_with_uninit( cx, src, dest, expr. span) ;
0 commit comments