@@ -32,13 +32,13 @@ pub fn pat_id_map(dm: &RefCell<DefMap>, pat: &hir::Pat) -> PatIdMap {
3232 map
3333}
3434
35- pub fn pat_is_refutable ( dm : & RefCell < DefMap > , pat : & hir:: Pat ) -> bool {
35+ pub fn pat_is_refutable ( dm : & DefMap , pat : & hir:: Pat ) -> bool {
3636 match pat. node {
3737 hir:: PatLit ( _) | hir:: PatRange ( _, _) | hir:: PatQPath ( ..) => true ,
3838 hir:: PatEnum ( _, _) |
3939 hir:: PatIdent ( _, _, None ) |
4040 hir:: PatStruct ( ..) => {
41- match dm. borrow ( ) . get ( & pat. id ) . map ( |d| d. full_def ( ) ) {
41+ match dm. get ( & pat. id ) . map ( |d| d. full_def ( ) ) {
4242 Some ( DefVariant ( ..) ) => true ,
4343 _ => false
4444 }
@@ -48,12 +48,12 @@ pub fn pat_is_refutable(dm: &RefCell<DefMap>, pat: &hir::Pat) -> bool {
4848 }
4949}
5050
51- pub fn pat_is_variant_or_struct ( dm : & RefCell < DefMap > , pat : & hir:: Pat ) -> bool {
51+ pub fn pat_is_variant_or_struct ( dm : & DefMap , pat : & hir:: Pat ) -> bool {
5252 match pat. node {
5353 hir:: PatEnum ( _, _) |
5454 hir:: PatIdent ( _, _, None ) |
5555 hir:: PatStruct ( ..) => {
56- match dm. borrow ( ) . get ( & pat. id ) . map ( |d| d. full_def ( ) ) {
56+ match dm. get ( & pat. id ) . map ( |d| d. full_def ( ) ) {
5757 Some ( DefVariant ( ..) ) | Some ( DefStruct ( ..) ) => true ,
5858 _ => false
5959 }
@@ -62,10 +62,10 @@ pub fn pat_is_variant_or_struct(dm: &RefCell<DefMap>, pat: &hir::Pat) -> bool {
6262 }
6363}
6464
65- pub fn pat_is_const ( dm : & RefCell < DefMap > , pat : & hir:: Pat ) -> bool {
65+ pub fn pat_is_const ( dm : & DefMap , pat : & hir:: Pat ) -> bool {
6666 match pat. node {
6767 hir:: PatIdent ( _, _, None ) | hir:: PatEnum ( ..) | hir:: PatQPath ( ..) => {
68- match dm. borrow ( ) . get ( & pat. id ) . map ( |d| d. full_def ( ) ) {
68+ match dm. get ( & pat. id ) . map ( |d| d. full_def ( ) ) {
6969 Some ( DefConst ( ..) ) | Some ( DefAssociatedConst ( ..) ) => true ,
7070 _ => false
7171 }
@@ -76,10 +76,10 @@ pub fn pat_is_const(dm: &RefCell<DefMap>, pat: &hir::Pat) -> bool {
7676
7777// Same as above, except that partially-resolved defs cause `false` to be
7878// returned instead of a panic.
79- pub fn pat_is_resolved_const ( dm : & RefCell < DefMap > , pat : & hir:: Pat ) -> bool {
79+ pub fn pat_is_resolved_const ( dm : & DefMap , pat : & hir:: Pat ) -> bool {
8080 match pat. node {
8181 hir:: PatIdent ( _, _, None ) | hir:: PatEnum ( ..) | hir:: PatQPath ( ..) => {
82- match dm. borrow ( ) . get ( & pat. id )
82+ match dm. get ( & pat. id )
8383 . and_then ( |d| if d. depth == 0 { Some ( d. base_def ) }
8484 else { None } ) {
8585 Some ( DefConst ( ..) ) | Some ( DefAssociatedConst ( ..) ) => true ,
@@ -90,7 +90,7 @@ pub fn pat_is_resolved_const(dm: &RefCell<DefMap>, pat: &hir::Pat) -> bool {
9090 }
9191}
9292
93- pub fn pat_is_binding ( dm : & RefCell < DefMap > , pat : & hir:: Pat ) -> bool {
93+ pub fn pat_is_binding ( dm : & DefMap , pat : & hir:: Pat ) -> bool {
9494 match pat. node {
9595 hir:: PatIdent ( ..) => {
9696 !pat_is_variant_or_struct ( dm, pat) &&
@@ -100,7 +100,7 @@ pub fn pat_is_binding(dm: &RefCell<DefMap>, pat: &hir::Pat) -> bool {
100100 }
101101}
102102
103- pub fn pat_is_binding_or_wild ( dm : & RefCell < DefMap > , pat : & hir:: Pat ) -> bool {
103+ pub fn pat_is_binding_or_wild ( dm : & DefMap , pat : & hir:: Pat ) -> bool {
104104 match pat. node {
105105 hir:: PatIdent ( ..) => pat_is_binding ( dm, pat) ,
106106 hir:: PatWild => true ,
@@ -115,7 +115,7 @@ pub fn pat_bindings<I>(dm: &RefCell<DefMap>, pat: &hir::Pat, mut it: I) where
115115{
116116 walk_pat ( pat, |p| {
117117 match p. node {
118- hir:: PatIdent ( binding_mode, ref pth, _) if pat_is_binding ( dm , p) => {
118+ hir:: PatIdent ( binding_mode, ref pth, _) if pat_is_binding ( & dm . borrow ( ) , p) => {
119119 it ( binding_mode, p. id , p. span , & respan ( pth. span , pth. node . name ) ) ;
120120 }
121121 _ => { }
@@ -129,7 +129,7 @@ pub fn pat_bindings_hygienic<I>(dm: &RefCell<DefMap>, pat: &hir::Pat, mut it: I)
129129{
130130 walk_pat ( pat, |p| {
131131 match p. node {
132- hir:: PatIdent ( binding_mode, ref pth, _) if pat_is_binding ( dm , p) => {
132+ hir:: PatIdent ( binding_mode, ref pth, _) if pat_is_binding ( & dm . borrow ( ) , p) => {
133133 it ( binding_mode, p. id , p. span , & respan ( pth. span , pth. node ) ) ;
134134 }
135135 _ => { }
@@ -140,7 +140,7 @@ pub fn pat_bindings_hygienic<I>(dm: &RefCell<DefMap>, pat: &hir::Pat, mut it: I)
140140
141141/// Checks if the pattern contains any patterns that bind something to
142142/// an ident, e.g. `foo`, or `Foo(foo)` or `foo @ Bar(..)`.
143- pub fn pat_contains_bindings ( dm : & RefCell < DefMap > , pat : & hir:: Pat ) -> bool {
143+ pub fn pat_contains_bindings ( dm : & DefMap , pat : & hir:: Pat ) -> bool {
144144 let mut contains_bindings = false ;
145145 walk_pat ( pat, |p| {
146146 if pat_is_binding ( dm, p) {
@@ -185,7 +185,7 @@ pub fn arm_contains_ref_binding(dm: &RefCell<DefMap>, arm: &hir::Arm) -> Option<
185185
186186/// Checks if the pattern contains any patterns that bind something to
187187/// an ident or wildcard, e.g. `foo`, or `Foo(_)`, `foo @ Bar(..)`,
188- pub fn pat_contains_bindings_or_wild ( dm : & RefCell < DefMap > , pat : & hir:: Pat ) -> bool {
188+ pub fn pat_contains_bindings_or_wild ( dm : & DefMap , pat : & hir:: Pat ) -> bool {
189189 let mut contains_bindings = false ;
190190 walk_pat ( pat, |p| {
191191 if pat_is_binding_or_wild ( dm, p) {
@@ -221,14 +221,14 @@ pub fn def_to_path(tcx: &ty::ctxt, id: DefId) -> hir::Path {
221221}
222222
223223/// Return variants that are necessary to exist for the pattern to match.
224- pub fn necessary_variants ( dm : & RefCell < DefMap > , pat : & hir:: Pat ) -> Vec < DefId > {
224+ pub fn necessary_variants ( dm : & DefMap , pat : & hir:: Pat ) -> Vec < DefId > {
225225 let mut variants = vec ! [ ] ;
226226 walk_pat ( pat, |p| {
227227 match p. node {
228228 hir:: PatEnum ( _, _) |
229229 hir:: PatIdent ( _, _, None ) |
230230 hir:: PatStruct ( ..) => {
231- match dm. borrow ( ) . get ( & p. id ) {
231+ match dm. get ( & p. id ) {
232232 Some ( & PathResolution { base_def : DefVariant ( _, id, _) , .. } ) => {
233233 variants. push ( id) ;
234234 }
0 commit comments