clippy_utils

Function capture_local_usage

source
pub fn capture_local_usage(cx: &LateContext<'_>, e: &Expr<'_>) -> CaptureKind
Expand description

Given an expression referencing a local, determines how it would be captured in a closure.

Note as this will walk up to parent expressions until the capture can be determined it should only be used while making a closure somewhere a value is consumed. e.g. a block, match arm, or function argument (other than a receiver).