@@ -235,12 +235,11 @@ impl<D> CheckPoint<D> {
235
235
}
236
236
237
237
// Now iterate normally from the found starting point
238
- current. into_iter ( )
239
- . take_while ( move |cp| match start_bound {
240
- core:: ops:: Bound :: Included ( inc_bound) => cp. height ( ) >= inc_bound,
241
- core:: ops:: Bound :: Excluded ( exc_bound) => cp. height ( ) > exc_bound,
242
- core:: ops:: Bound :: Unbounded => true ,
243
- } )
238
+ current. into_iter ( ) . take_while ( move |cp| match start_bound {
239
+ core:: ops:: Bound :: Included ( inc_bound) => cp. height ( ) >= inc_bound,
240
+ core:: ops:: Bound :: Excluded ( exc_bound) => cp. height ( ) > exc_bound,
241
+ core:: ops:: Bound :: Unbounded => true ,
242
+ } )
244
243
}
245
244
246
245
/// Returns the checkpoint at `height` if one exists, otherwise the nearest checkpoint at a
@@ -390,12 +389,16 @@ where
390
389
let base_index = result. index ( ) ;
391
390
392
391
// First insert the new block
393
- result = result. push_with_index ( height, data, base_index + 1 ) . expect ( "height is valid" ) ;
392
+ result = result
393
+ . push_with_index ( height, data, base_index + 1 )
394
+ . expect ( "height is valid" ) ;
394
395
395
396
// Then re-add all the tail blocks with updated indices
396
397
let mut current_index = base_index + 2 ;
397
398
for ( h, d) in tail. into_iter ( ) . rev ( ) {
398
- result = result. push_with_index ( h, d, current_index) . expect ( "tail is in order" ) ;
399
+ result = result
400
+ . push_with_index ( h, d, current_index)
401
+ . expect ( "tail is in order" ) ;
399
402
current_index += 1 ;
400
403
}
401
404
@@ -406,7 +409,9 @@ where
406
409
fn push_with_index ( self , height : u32 , data : D , new_index : u32 ) -> Result < Self , Self > {
407
410
if self . height ( ) < height {
408
411
// Calculate skip pointer
409
- let skip = if new_index >= CHECKPOINT_SKIP_INTERVAL && new_index % CHECKPOINT_SKIP_INTERVAL == 0 {
412
+ let skip = if new_index >= CHECKPOINT_SKIP_INTERVAL
413
+ && new_index % CHECKPOINT_SKIP_INTERVAL == 0
414
+ {
410
415
// Navigate back CHECKPOINT_SKIP_INTERVAL checkpoints
411
416
let target_index = new_index - CHECKPOINT_SKIP_INTERVAL ;
412
417
let mut current = Some ( self . 0 . clone ( ) ) ;
@@ -453,7 +458,9 @@ where
453
458
let new_index = self . 0 . index + 1 ;
454
459
455
460
// Calculate skip pointer
456
- let skip = if new_index >= CHECKPOINT_SKIP_INTERVAL && new_index % CHECKPOINT_SKIP_INTERVAL == 0 {
461
+ let skip = if new_index >= CHECKPOINT_SKIP_INTERVAL
462
+ && new_index % CHECKPOINT_SKIP_INTERVAL == 0
463
+ {
457
464
// Navigate back CHECKPOINT_SKIP_INTERVAL checkpoints
458
465
let mut current = Some ( self . 0 . clone ( ) ) ;
459
466
let mut steps = 0 ;
0 commit comments