mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-30 04:56:25 +03:00
is_closure_like
This commit is contained in:
@@ -101,7 +101,7 @@ fn check_local(&mut self, cx: &LateContext<'tcx>, local: &'tcx Local<'tcx>) {
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user