@@ -13,23 +13,11 @@ use hir::hir_def::{scope_graph::ScopeId, Body as HirBody, LitKind, Pat as HirPat
13
13
#[ derive( Clone , Debug , PartialEq , Eq ) ]
14
14
pub struct PatternMatrix < ' db > {
15
15
pub rows : Vec < PatternRowVec < ' db > > ,
16
- /// Column count for empty matrices (when rows.is_empty())
17
- column_count : Option < usize > ,
18
16
}
19
17
20
18
impl < ' db > PatternMatrix < ' db > {
21
19
pub fn new ( rows : Vec < PatternRowVec < ' db > > ) -> Self {
22
- Self {
23
- rows,
24
- column_count : None ,
25
- }
26
- }
27
-
28
- pub fn new_with_column_count ( rows : Vec < PatternRowVec < ' db > > , column_count : usize ) -> Self {
29
- Self {
30
- rows,
31
- column_count : Some ( column_count) ,
32
- }
20
+ Self { rows }
33
21
}
34
22
35
23
pub fn from_hir_patterns (
@@ -48,10 +36,7 @@ impl<'db> PatternMatrix<'db> {
48
36
) ] )
49
37
} )
50
38
. collect ( ) ;
51
- Self {
52
- rows,
53
- column_count : None ,
54
- }
39
+ Self { rows }
55
40
}
56
41
57
42
/// Find missing patterns that would make the matrix exhaustive
@@ -163,7 +148,6 @@ impl<'db> PatternMatrix<'db> {
163
148
164
149
let previous = PatternMatrix {
165
150
rows : self . rows [ 0 ..row] . to_vec ( ) ,
166
- column_count : None ,
167
151
} ;
168
152
previous. is_pattern_useful ( db, & self . rows [ row] )
169
153
}
@@ -216,15 +200,7 @@ impl<'db> PatternMatrix<'db> {
216
200
. flat_map ( |row| row. phi_specialize ( db, ctor) )
217
201
. collect ( ) ;
218
202
219
- // Calculate column count for specialized matrix
220
- let new_column_count = if rows. is_empty ( ) && self . ncols ( ) > 0 {
221
- // Original columns - 1 (removed) + ctor.arity (added)
222
- Some ( self . ncols ( ) - 1 + ctor. arity ( db) )
223
- } else {
224
- None
225
- } ;
226
-
227
- PatternMatrix :: new_with_column_count ( rows, new_column_count. unwrap_or ( 0 ) )
203
+ PatternMatrix :: new ( rows)
228
204
}
229
205
230
206
pub fn d_specialize ( & self ) -> Self {
@@ -234,14 +210,7 @@ impl<'db> PatternMatrix<'db> {
234
210
. flat_map ( |row| row. d_specialize ( ) )
235
211
. collect ( ) ;
236
212
237
- // Default specialization removes one column
238
- let new_column_count = if rows. is_empty ( ) && self . ncols ( ) > 0 {
239
- Some ( self . ncols ( ) - 1 )
240
- } else {
241
- None
242
- } ;
243
-
244
- PatternMatrix :: new_with_column_count ( rows, new_column_count. unwrap_or ( 0 ) )
213
+ PatternMatrix :: new ( rows)
245
214
}
246
215
247
216
pub fn sigma_set ( & self ) -> SigmaSet < ' db > {
@@ -258,7 +227,7 @@ impl<'db> PatternMatrix<'db> {
258
227
259
228
pub fn ncols ( & self ) -> usize {
260
229
if self . nrows ( ) == 0 {
261
- self . column_count . unwrap_or ( 0 )
230
+ 0
262
231
} else {
263
232
let ncols = self . rows [ 0 ] . len ( ) ;
264
233
debug_assert ! ( self . rows. iter( ) . all( |row| row. len( ) == ncols) ) ;
0 commit comments