File tree 1 file changed +12
-18
lines changed
crates/matrix-sdk/src/event_cache
1 file changed +12
-18
lines changed Original file line number Diff line number Diff line change @@ -542,16 +542,13 @@ pub mod experimental {
542
542
type Item = ( ChunkPosition , & ' a Chunk < T , C > ) ;
543
543
544
544
fn next ( & mut self ) -> Option < Self :: Item > {
545
- let Some ( chunk) = self . chunk else {
546
- return None ;
547
- } ;
548
-
549
- let position = self . position ;
550
-
551
- self . chunk = chunk. previous ( ) ;
552
- self . position += 1 ;
545
+ self . chunk . map ( |chunk| {
546
+ let position = self . position ;
547
+ self . chunk = chunk. previous ( ) ;
548
+ self . position += 1 ;
553
549
554
- Some ( ( position, chunk) )
550
+ ( position, chunk)
551
+ } )
555
552
}
556
553
}
557
554
@@ -573,16 +570,13 @@ pub mod experimental {
573
570
type Item = ( ChunkPosition , & ' a Chunk < T , C > ) ;
574
571
575
572
fn next ( & mut self ) -> Option < Self :: Item > {
576
- let Some ( chunk) = self . chunk else {
577
- return None ;
578
- } ;
579
-
580
- let position = self . position ;
581
-
582
- self . chunk = chunk. next ( ) ;
583
- self . position = self . position . saturating_sub ( 1 ) ;
573
+ self . chunk . map ( |chunk| {
574
+ let position = self . position ;
575
+ self . chunk = chunk. next ( ) ;
576
+ self . position = self . position . saturating_sub ( 1 ) ;
584
577
585
- Some ( ( position, chunk) )
578
+ ( position, chunk)
579
+ } )
586
580
}
587
581
}
588
582
You can’t perform that action at this time.
0 commit comments