diff options
| author | Michael Goulet <michael@errs.io> | 2024-02-11 21:36:12 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-02-11 22:09:52 +0000 |
| commit | 4fbd5cc31fad26f5cb439ece09e634310c6868ae (patch) | |
| tree | 968fe346e5fe58ee9115205b702c5920f1bc7ef2 | |
| parent | 8f00ffc901badd27e7d58641daecb30b8cd76a74 (diff) | |
| download | rust-4fbd5cc31fad26f5cb439ece09e634310c6868ae.tar.gz rust-4fbd5cc31fad26f5cb439ece09e634310c6868ae.zip | |
is_closure_like
| -rw-r--r-- | clippy_lints/src/redundant_locals.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clippy_lints/src/redundant_locals.rs b/clippy_lints/src/redundant_locals.rs index 700a5dd4a85..6528a7b369f 100644 --- a/clippy_lints/src/redundant_locals.rs +++ b/clippy_lints/src/redundant_locals.rs @@ -101,7 +101,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantLocals { fn is_by_value_closure_capture(cx: &LateContext<'_>, redefinition: HirId, root_variable: HirId) -> bool { let closure_def_id = cx.tcx.hir().enclosing_body_owner(redefinition); - cx.tcx.is_closure_or_coroutine(closure_def_id.to_def_id()) + cx.tcx.is_closure_like(closure_def_id.to_def_id()) && cx.tcx.closure_captures(closure_def_id).iter().any(|c| { matches!(c.info.capture_kind, UpvarCapture::ByValue) && matches!(c.place.base, PlaceBase::Upvar(upvar) if upvar.var_path.hir_id == root_variable) |
