@@ -37,11 +37,11 @@ pub struct DeconstructedPat<'p, 'tcx> {
37
37
}
38
38
39
39
impl < ' p , ' tcx > DeconstructedPat < ' p , ' tcx > {
40
- pub ( super ) fn wildcard ( ty : Ty < ' tcx > , span : Span ) -> Self {
40
+ pub fn wildcard ( ty : Ty < ' tcx > , span : Span ) -> Self {
41
41
Self :: new ( Wildcard , & [ ] , ty, span)
42
42
}
43
43
44
- pub ( super ) fn new (
44
+ pub fn new (
45
45
ctor : Constructor < ' tcx > ,
46
46
fields : & ' p [ DeconstructedPat < ' p , ' tcx > ] ,
47
47
ty : Ty < ' tcx > ,
@@ -50,11 +50,11 @@ impl<'p, 'tcx> DeconstructedPat<'p, 'tcx> {
50
50
DeconstructedPat { ctor, fields, ty, span, useful : Cell :: new ( false ) }
51
51
}
52
52
53
- pub ( super ) fn is_or_pat ( & self ) -> bool {
53
+ pub ( crate ) fn is_or_pat ( & self ) -> bool {
54
54
matches ! ( self . ctor, Or )
55
55
}
56
56
/// Expand this (possibly-nested) or-pattern into its alternatives.
57
- pub ( super ) fn flatten_or_pat ( & ' p self ) -> SmallVec < [ & ' p Self ; 1 ] > {
57
+ pub ( crate ) fn flatten_or_pat ( & ' p self ) -> SmallVec < [ & ' p Self ; 1 ] > {
58
58
if self . is_or_pat ( ) {
59
59
self . iter_fields ( ) . flat_map ( |p| p. flatten_or_pat ( ) ) . collect ( )
60
60
} else {
@@ -80,7 +80,7 @@ impl<'p, 'tcx> DeconstructedPat<'p, 'tcx> {
80
80
81
81
/// Specialize this pattern with a constructor.
82
82
/// `other_ctor` can be different from `self.ctor`, but must be covered by it.
83
- pub ( super ) fn specialize < ' a > (
83
+ pub ( crate ) fn specialize < ' a > (
84
84
& ' a self ,
85
85
pcx : & PatCtxt < ' _ , ' p , ' tcx > ,
86
86
other_ctor : & Constructor < ' tcx > ,
@@ -122,10 +122,10 @@ impl<'p, 'tcx> DeconstructedPat<'p, 'tcx> {
122
122
123
123
/// We keep track for each pattern if it was ever useful during the analysis. This is used
124
124
/// with `redundant_spans` to report redundant subpatterns arising from or patterns.
125
- pub ( super ) fn set_useful ( & self ) {
125
+ pub ( crate ) fn set_useful ( & self ) {
126
126
self . useful . set ( true )
127
127
}
128
- pub ( super ) fn is_useful ( & self ) -> bool {
128
+ pub ( crate ) fn is_useful ( & self ) -> bool {
129
129
if self . useful . get ( ) {
130
130
true
131
131
} else if self . is_or_pat ( ) && self . iter_fields ( ) . any ( |f| f. is_useful ( ) ) {
@@ -140,7 +140,7 @@ impl<'p, 'tcx> DeconstructedPat<'p, 'tcx> {
140
140
}
141
141
142
142
/// Report the spans of subpatterns that were not useful, if any.
143
- pub ( super ) fn redundant_spans ( & self ) -> Vec < Span > {
143
+ pub ( crate ) fn redundant_spans ( & self ) -> Vec < Span > {
144
144
let mut spans = Vec :: new ( ) ;
145
145
self . collect_redundant_spans ( & mut spans) ;
146
146
spans
@@ -175,17 +175,17 @@ pub struct WitnessPat<'tcx> {
175
175
}
176
176
177
177
impl < ' tcx > WitnessPat < ' tcx > {
178
- pub ( super ) fn new ( ctor : Constructor < ' tcx > , fields : Vec < Self > , ty : Ty < ' tcx > ) -> Self {
178
+ pub ( crate ) fn new ( ctor : Constructor < ' tcx > , fields : Vec < Self > , ty : Ty < ' tcx > ) -> Self {
179
179
Self { ctor, fields, ty }
180
180
}
181
- pub ( super ) fn wildcard ( ty : Ty < ' tcx > ) -> Self {
181
+ pub ( crate ) fn wildcard ( ty : Ty < ' tcx > ) -> Self {
182
182
Self :: new ( Wildcard , Vec :: new ( ) , ty)
183
183
}
184
184
185
185
/// Construct a pattern that matches everything that starts with this constructor.
186
186
/// For example, if `ctor` is a `Constructor::Variant` for `Option::Some`, we get the pattern
187
187
/// `Some(_)`.
188
- pub ( super ) fn wild_from_ctor ( pcx : & PatCtxt < ' _ , ' _ , ' tcx > , ctor : Constructor < ' tcx > ) -> Self {
188
+ pub ( crate ) fn wild_from_ctor ( pcx : & PatCtxt < ' _ , ' _ , ' tcx > , ctor : Constructor < ' tcx > ) -> Self {
189
189
let field_tys =
190
190
pcx. cx . ctor_wildcard_fields ( & ctor, pcx. ty ) . iter ( ) . map ( |deco_pat| deco_pat. ty ( ) ) ;
191
191
let fields = field_tys. map ( |ty| Self :: wildcard ( ty) ) . collect ( ) ;
0 commit comments