11use std:: { collections:: VecDeque , marker:: PhantomData } ;
22
3- use rustc_index:: { bit_set :: BitSet , vec:: Idx } ;
3+ use rustc_index:: vec:: Idx ;
44
55#[ derive( Copy , Clone , Debug ) ]
66enum Undo < T > {
@@ -12,18 +12,12 @@ enum Undo<T> {
1212pub struct ModifiedSet < T : Idx > {
1313 modified : VecDeque < Undo < T > > ,
1414 snapshots : usize ,
15- modified_set : BitSet < T > ,
1615 offsets : Vec < usize > ,
1716}
1817
1918impl < T : Idx > Default for ModifiedSet < T > {
2019 fn default ( ) -> Self {
21- Self {
22- modified : Default :: default ( ) ,
23- snapshots : 0 ,
24- modified_set : BitSet :: new_empty ( 0 ) ,
25- offsets : Vec :: new ( ) ,
26- }
20+ Self { modified : Default :: default ( ) , snapshots : 0 , offsets : Vec :: new ( ) }
2721 }
2822}
2923
@@ -33,12 +27,7 @@ impl<T: Idx> ModifiedSet<T> {
3327 }
3428
3529 pub fn set ( & mut self , index : T ) {
36- if index. index ( ) >= self . modified_set . domain_size ( ) {
37- self . modified_set . resize ( index. index ( ) + 1 ) ;
38- }
39- if self . modified_set . insert ( index) {
40- self . modified . push_back ( Undo :: Add ( index) ) ;
41- }
30+ self . modified . push_back ( Undo :: Add ( index) ) ;
4231 }
4332
4433 pub fn drain ( & mut self , index : & Offset < T > , mut f : impl FnMut ( T ) -> bool ) {
@@ -66,9 +55,7 @@ impl<T: Idx> ModifiedSet<T> {
6655 self . modified . iter ( ) . rev ( ) . take ( self . modified . len ( ) - snapshot. modified_len )
6756 {
6857 match undo {
69- Undo :: Add ( index) => {
70- self . modified_set . remove ( index) ;
71- }
58+ Undo :: Add ( _) => { }
7259 Undo :: Drain { index, offset } => {
7360 if let Some ( o) = self . offsets . get_mut ( index) {
7461 * o = offset;
0 commit comments