@@ -2,7 +2,6 @@ use crate::def::{CtorOf, DefKind, Res};
22use crate :: def_id:: DefId ;
33use crate :: hir:: { self , HirId , PatKind } ;
44use rustc_span:: symbol:: Ident ;
5- use rustc_span:: Span ;
65
76use std:: iter:: { Enumerate , ExactSizeIterator } ;
87
@@ -60,10 +59,10 @@ impl<T: ExactSizeIterator> EnumerateAndAdjustIterator for T {
6059impl hir:: Pat < ' _ > {
6160 /// Call `f` on every "binding" in a pattern, e.g., on `a` in
6261 /// `match foo() { Some(a) => (), None => () }`
63- pub fn each_binding ( & self , mut f : impl FnMut ( hir:: BindingAnnotation , HirId , Span , Ident ) ) {
62+ pub fn each_binding ( & self , mut f : impl FnMut ( hir:: BindingAnnotation , HirId , Ident ) ) {
6463 self . walk_always ( |p| {
6564 if let PatKind :: Binding ( binding_mode, _, ident, _) = p. kind {
66- f ( binding_mode, p. hir_id , p . span , ident) ;
65+ f ( binding_mode, p. hir_id , ident) ;
6766 }
6867 } ) ;
6968 }
@@ -72,17 +71,14 @@ impl hir::Pat<'_> {
7271 /// `match foo() { Some(a) => (), None => () }`.
7372 ///
7473 /// When encountering an or-pattern `p_0 | ... | p_n` only `p_0` will be visited.
75- pub fn each_binding_or_first (
76- & self ,
77- f : & mut impl FnMut ( hir:: BindingAnnotation , HirId , Span , Ident ) ,
78- ) {
74+ pub fn each_binding_or_first ( & self , f : & mut impl FnMut ( hir:: BindingAnnotation , HirId , Ident ) ) {
7975 self . walk ( |p| match & p. kind {
8076 PatKind :: Or ( ps) => {
8177 ps[ 0 ] . each_binding_or_first ( f) ;
8278 false
8379 }
8480 PatKind :: Binding ( bm, _, ident, _) => {
85- f ( * bm, p. hir_id , p . span , * ident) ;
81+ f ( * bm, p. hir_id , * ident) ;
8682 true
8783 }
8884 _ => true ,
@@ -150,7 +146,7 @@ impl hir::Pat<'_> {
150146 // ref bindings are be implicit after #42640 (default match binding modes). See issue #44848.
151147 pub fn contains_explicit_ref_binding ( & self ) -> Option < hir:: Mutability > {
152148 let mut result = None ;
153- self . each_binding ( |annotation, _, _, _ | match annotation {
149+ self . each_binding ( |annotation, _, _| match annotation {
154150 hir:: BindingAnnotation :: Ref => match result {
155151 None | Some ( hir:: Mutability :: Not ) => result = Some ( hir:: Mutability :: Not ) ,
156152 _ => { }
0 commit comments