File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ impl TextEdit {
119119 return Err ( other) ;
120120 }
121121 self . indels . extend ( other. indels ) ;
122- assert ! ( check_disjoint ( & mut self . indels) ) ;
122+ assert_disjoint ( & mut self . indels ) ;
123123 Ok ( ( ) )
124124 }
125125
@@ -169,7 +169,7 @@ impl TextEditBuilder {
169169 }
170170 pub fn finish ( self ) -> TextEdit {
171171 let mut indels = self . indels ;
172- assert ! ( check_disjoint ( & mut indels) ) ;
172+ assert_disjoint ( & mut indels) ;
173173 TextEdit { indels }
174174 }
175175 pub fn invalidates_offset ( & self , offset : TextSize ) -> bool {
@@ -178,11 +178,14 @@ impl TextEditBuilder {
178178 fn indel ( & mut self , indel : Indel ) {
179179 self . indels . push ( indel) ;
180180 if self . indels . len ( ) <= 16 {
181- check_disjoint ( & mut self . indels ) ;
181+ assert_disjoint ( & mut self . indels ) ;
182182 }
183183 }
184184}
185185
186+ fn assert_disjoint ( indels : & mut [ impl std:: borrow:: Borrow < Indel > ] ) {
187+ assert ! ( check_disjoint( indels) ) ;
188+ }
186189fn check_disjoint ( indels : & mut [ impl std:: borrow:: Borrow < Indel > ] ) -> bool {
187190 indels. sort_by_key ( |indel| ( indel. borrow ( ) . delete . start ( ) , indel. borrow ( ) . delete . end ( ) ) ) ;
188191 indels
You can’t perform that action at this time.
0 commit comments