File tree 1 file changed +12
-10
lines changed
1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -733,16 +733,18 @@ impl std::ops::BitOrAssign for CaptureKind {
733
733
pub fn capture_local_usage ( cx : & LateContext < ' tcx > , e : & Expr < ' _ > ) -> CaptureKind {
734
734
fn pat_capture_kind ( cx : & LateContext < ' _ > , pat : & Pat < ' _ > ) -> CaptureKind {
735
735
let mut capture = CaptureKind :: Ref ( Mutability :: Not ) ;
736
- pat. each_binding ( |_, id, span, _| {
737
- match cx. typeck_results ( ) . extract_binding_mode ( cx. sess ( ) , id, span) . unwrap ( ) {
738
- BindingMode :: BindByValue ( _) if !is_copy ( cx, cx. typeck_results ( ) . node_type ( id) ) => {
739
- capture = CaptureKind :: Value ;
740
- } ,
741
- BindingMode :: BindByReference ( Mutability :: Mut ) if capture != CaptureKind :: Value => {
742
- capture = CaptureKind :: Ref ( Mutability :: Mut ) ;
743
- } ,
744
- _ => ( ) ,
745
- }
736
+ pat. each_binding_or_first ( & mut |_, id, span, _| match cx
737
+ . typeck_results ( )
738
+ . extract_binding_mode ( cx. sess ( ) , id, span)
739
+ . unwrap ( )
740
+ {
741
+ BindingMode :: BindByValue ( _) if !is_copy ( cx, cx. typeck_results ( ) . node_type ( id) ) => {
742
+ capture = CaptureKind :: Value ;
743
+ } ,
744
+ BindingMode :: BindByReference ( Mutability :: Mut ) if capture != CaptureKind :: Value => {
745
+ capture = CaptureKind :: Ref ( Mutability :: Mut ) ;
746
+ } ,
747
+ _ => ( ) ,
746
748
} ) ;
747
749
capture
748
750
}
You can’t perform that action at this time.
0 commit comments