File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
crates/matrix-sdk/src/event_cache/room Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -708,13 +708,18 @@ mod private {
708
708
}
709
709
710
710
// At this point, `current` is the identifier of the first chunk.
711
+ //
711
712
// Reorder the resulting vector, by going through the chain of `next` links, and
712
713
// swapping items into their final position.
714
+ //
715
+ // Invariant in this loop: all items in [0..i[ are in their final, correct
716
+ // position.
713
717
let mut current = current. identifier ;
714
718
for i in 0 ..all_chunks. len ( ) {
715
719
// Find the target metadata.
716
720
let j = all_chunks
717
721
. iter ( )
722
+ . rev ( )
718
723
. position ( |meta| meta. identifier == current)
719
724
. expect ( "the target chunk must be present in the metadata" ) ;
720
725
if i != j {
You can’t perform that action at this time.
0 commit comments