@@ -195,7 +195,7 @@ impl_event_cache_store! {
195
195
}
196
196
Update :: RemoveChunk ( chunk_id) => {
197
197
trace!( "Removing chunk {chunk_id:?}" ) ;
198
- transaction. delete_chunk_by_id( room_id, & chunk_id) . await ?;
198
+ transaction. delete_chunk_by_id( room_id, chunk_id) . await ?;
199
199
}
200
200
Update :: PushItems { at, items } => {
201
201
let chunk_identifier = at. chunk_identifier( ) . index( ) ;
@@ -239,15 +239,15 @@ impl_event_cache_store! {
239
239
240
240
trace!( %room_id, "removing item @ {chunk_id}:{index}" ) ;
241
241
242
- transaction. delete_event_by_position( room_id, & at. into( ) ) . await ?;
242
+ transaction. delete_event_by_position( room_id, at. into( ) ) . await ?;
243
243
}
244
244
Update :: DetachLastItems { at } => {
245
245
let chunk_id = at. chunk_identifier( ) . index( ) ;
246
246
let index = at. index( ) ;
247
247
248
248
trace!( %room_id, "detaching last items @ {chunk_id}:{index}" ) ;
249
249
250
- transaction. delete_events_by_chunk_from_index( room_id, & at. into( ) ) . await ?;
250
+ transaction. delete_events_by_chunk_from_index( room_id, at. into( ) ) . await ?;
251
251
}
252
252
Update :: StartReattachItems | Update :: EndReattachItems => {
253
253
// Nothing? See sqlite implementation
@@ -283,7 +283,7 @@ impl_event_cache_store! {
283
283
let chunks = transaction. get_chunks_in_room( room_id) . await ?;
284
284
for chunk in chunks {
285
285
if let Some ( raw_chunk) = transaction
286
- . load_chunk_by_id( room_id, & ChunkIdentifier :: new( chunk. identifier) )
286
+ . load_chunk_by_id( room_id, ChunkIdentifier :: new( chunk. identifier) )
287
287
. await ?
288
288
{
289
289
raw_chunks. push( raw_chunk) ;
@@ -321,7 +321,7 @@ impl_event_cache_store! {
321
321
let chunks = transaction. get_chunks_in_room( room_id) . await ?;
322
322
for chunk in chunks {
323
323
let chunk_id = ChunkIdentifier :: new( chunk. identifier) ;
324
- let num_items = transaction. get_events_count_by_chunk( room_id, & chunk_id) . await ?;
324
+ let num_items = transaction. get_events_count_by_chunk( room_id, chunk_id) . await ?;
325
325
raw_chunks. push( ChunkMetadata {
326
326
num_items,
327
327
previous: chunk. previous. map( ChunkIdentifier :: new) ,
@@ -355,7 +355,7 @@ impl_event_cache_store! {
355
355
// Now that we know we have some chunks in the room, we query IndexedDB
356
356
// for the last chunk in the room by getting the chunk which does not
357
357
// have a next chunk.
358
- match transaction. get_chunk_by_next_chunk_id( room_id, & None ) . await {
358
+ match transaction. get_chunk_by_next_chunk_id( room_id, None ) . await {
359
359
Err ( IndexeddbEventCacheStoreTransactionError :: ItemIsNotUnique ) => {
360
360
// If there are multiple chunks that do not have a next chunk, that
361
361
// means we have more than one last chunk, which means that we have
@@ -375,7 +375,7 @@ impl_event_cache_store! {
375
375
Ok ( Some ( last_chunk) ) => {
376
376
let last_chunk_identifier = ChunkIdentifier :: new( last_chunk. identifier) ;
377
377
let last_raw_chunk = transaction
378
- . load_chunk_by_id( room_id, & last_chunk_identifier)
378
+ . load_chunk_by_id( room_id, last_chunk_identifier)
379
379
. await ?
380
380
. ok_or( IndexeddbEventCacheStoreError :: UnableToLoadChunk ) ?;
381
381
let max_chunk_id = transaction
@@ -404,10 +404,10 @@ impl_event_cache_store! {
404
404
& [ keys:: LINKED_CHUNKS , keys:: EVENTS , keys:: GAPS ] ,
405
405
IdbTransactionMode :: Readonly ,
406
406
) ?;
407
- if let Some ( chunk) = transaction. get_chunk_by_id( room_id, & before_chunk_identifier) . await ? {
407
+ if let Some ( chunk) = transaction. get_chunk_by_id( room_id, before_chunk_identifier) . await ? {
408
408
if let Some ( previous_identifier) = chunk. previous {
409
409
let previous_identifier = ChunkIdentifier :: new( previous_identifier) ;
410
- return Ok ( transaction. load_chunk_by_id( room_id, & previous_identifier) . await ?) ;
410
+ return Ok ( transaction. load_chunk_by_id( room_id, previous_identifier) . await ?) ;
411
411
}
412
412
}
413
413
Ok ( None )
@@ -447,7 +447,7 @@ impl_event_cache_store! {
447
447
let mut duplicated = Vec :: new( ) ;
448
448
for event_id in events {
449
449
if let Some ( types:: Event :: InBand ( event) ) =
450
- transaction. get_event_by_id( room_id, & event_id) . await ?
450
+ transaction. get_event_by_id( room_id, event_id. clone ( ) ) . await ?
451
451
{
452
452
duplicated. push( ( event_id, event. position. into( ) ) ) ;
453
453
}
@@ -466,7 +466,7 @@ impl_event_cache_store! {
466
466
let transaction =
467
467
self . transaction( & [ keys:: EVENTS ] , IdbTransactionMode :: Readonly ) ?;
468
468
transaction
469
- . get_event_by_id( room_id, & event_id. to_owned( ) )
469
+ . get_event_by_id( room_id, event_id. to_owned( ) )
470
470
. await
471
471
. map( |ok| ok. map( Into :: into) )
472
472
. map_err( Into :: into)
@@ -489,7 +489,7 @@ impl_event_cache_store! {
489
489
Some ( relation_types) if !relation_types. is_empty( ) => {
490
490
for relation_type in relation_types {
491
491
let relation = ( event_id. to_owned( ) , relation_type. clone( ) ) ;
492
- let events = transaction. get_events_by_relation( room_id, & relation) . await ?;
492
+ let events = transaction. get_events_by_relation( room_id, relation) . await ?;
493
493
for event in events {
494
494
let position = event. position( ) . map( Into :: into) ;
495
495
related_events. push( ( event. into( ) , position) ) ;
@@ -498,7 +498,7 @@ impl_event_cache_store! {
498
498
}
499
499
_ => {
500
500
for event in
501
- transaction. get_events_by_related_event( room_id, & event_id. to_owned( ) ) . await ?
501
+ transaction. get_events_by_related_event( room_id, event_id. to_owned( ) ) . await ?
502
502
{
503
503
let position = event. position( ) . map( Into :: into) ;
504
504
related_events. push( ( event. into( ) , position) ) ;
@@ -522,7 +522,7 @@ impl_event_cache_store! {
522
522
} ;
523
523
let transaction =
524
524
self . transaction( & [ keys:: EVENTS ] , IdbTransactionMode :: Readwrite ) ?;
525
- let event = match transaction. get_event_by_id( room_id, & event_id) . await ? {
525
+ let event = match transaction. get_event_by_id( room_id, event_id) . await ? {
526
526
Some ( mut inner) => inner. with_content( event) ,
527
527
None => types:: Event :: OutOfBand ( OutOfBandEvent { content: event, position: ( ) } ) ,
528
528
} ;
0 commit comments