Skip to content

Commit a055aa3

Browse files
committed
chore(sdk): Fix comments and rename variables.
1 parent 5c7a733 commit a055aa3

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

crates/matrix-sdk-common/src/linked_chunk/builder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl LinkedChunkBuilder {
6161

6262
// Create the `LinkedChunk` from a single chunk.
6363
{
64-
// This is the only chunk. Pretend it has no previous chunk if any.
64+
// Take the `previous` chunk and consider it becomes the `lazy_previous`.
6565
let lazy_previous = chunk.previous.take();
6666

6767
// Transform the `RawChunk` into a `Chunk`.
@@ -184,7 +184,7 @@ impl LinkedChunkBuilder {
184184
}
185185
}
186186

187-
// Emit the updates..
187+
// Emit the updates.
188188
if let Some(updates) = linked_chunk.updates.as_mut() {
189189
let first_chunk = linked_chunk.links.first_chunk();
190190

crates/matrix-sdk/src/event_cache/pagination.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ impl RoomPagination {
238238
// Reverse the order of the events as `/messages` has been called with `dir=b`
239239
// (backwards). The `RoomEvents` API expects the first event to be the oldest.
240240
// Let's re-order them for this block.
241-
let events = events
241+
let reversed_events = events
242242
.iter()
243243
.rev()
244244
.cloned()
@@ -258,7 +258,7 @@ impl RoomPagination {
258258
trace!("replacing previous gap with the back-paginated events");
259259

260260
// Replace the gap with the events we just deduplicated.
261-
room_events.replace_gap_at(events.clone(), gap_id)
261+
room_events.replace_gap_at(reversed_events.clone(), gap_id)
262262
.expect("gap_identifier is a valid chunk id we read previously")
263263
}
264264
} else if let Some(pos) = first_event_pos {
@@ -267,15 +267,15 @@ impl RoomPagination {
267267
trace!("inserted events before the first known event");
268268

269269
room_events
270-
.insert_events_at(events.clone(), pos)
270+
.insert_events_at(reversed_events.clone(), pos)
271271
.expect("pos is a valid position we just read above");
272272

273273
Some(pos)
274274
} else {
275275
// No prior gap, and no prior events: push the events.
276276
trace!("pushing events received from back-pagination");
277277

278-
room_events.push_events(events.clone());
278+
room_events.push_events(reversed_events.clone());
279279

280280
// A new gap may be inserted before the new events, if there are any.
281281
room_events.events().next().map(|(item_pos, _)| item_pos)
@@ -299,7 +299,7 @@ impl RoomPagination {
299299
debug!("not storing previous batch token, because we deduplicated all new back-paginated events");
300300
}
301301

302-
room_events.on_new_events(&self.inner.room_version, events.iter());
302+
room_events.on_new_events(&self.inner.room_version, reversed_events.iter());
303303
})
304304
.await?;
305305

crates/matrix-sdk/src/event_cache/room/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -657,10 +657,6 @@ mod private {
657657
}
658658

659659
/// Load more events backwards if the last chunk is **not** a gap.
660-
///
661-
/// Return `Ok(Some((events, reached_start), _))` if events have been
662-
/// inserted, `Ok(None)` if a gap has been inserted or if the
663-
/// store is disabled.
664660
#[must_use = "Updates as `VectorDiff` must probably be propagated via `RoomEventCacheUpdate`"]
665661
pub(in super::super) async fn load_more_events_backwards(
666662
&mut self,

0 commit comments

Comments
 (0)