Skip to content

Commit

Permalink
Use each_binding_or_first in capture_local_usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarcho committed Aug 16, 2021
1 parent 10c0460 commit 254974a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion clippy_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ impl std::ops::BitOrAssign for CaptureKind {
pub fn capture_local_usage(cx: &LateContext<'tcx>, e: &Expr<'_>) -> CaptureKind {
fn pat_capture_kind(cx: &LateContext<'_>, pat: &Pat<'_>) -> CaptureKind {
let mut capture = CaptureKind::Ref(Mutability::Not);
pat.each_binding(|_, id, span, _| {
pat.each_binding_or_first(|_, id, span, _| {
match cx.typeck_results().extract_binding_mode(cx.sess(), id, span).unwrap() {
BindingMode::BindByValue(_) if !is_copy(cx, cx.typeck_results().node_type(id)) => {
capture = CaptureKind::Value;
Expand Down

0 comments on commit 254974a

Please sign in to comment.