fix needless pass by value
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
875d9e8b07
commit
57acc4f655
15 changed files with 40 additions and 42 deletions
|
@ -27,7 +27,7 @@ impl Data {
|
|||
}
|
||||
}
|
||||
|
||||
pub(super) fn readreceipt_update(&self, user_id: &UserId, room_id: &RoomId, event: ReceiptEvent) -> Result<()> {
|
||||
pub(super) fn readreceipt_update(&self, user_id: &UserId, room_id: &RoomId, event: &ReceiptEvent) -> Result<()> {
|
||||
let mut prefix = room_id.as_bytes().to_vec();
|
||||
prefix.push(0xFF);
|
||||
|
||||
|
@ -56,7 +56,7 @@ impl Data {
|
|||
|
||||
self.readreceiptid_readreceipt.insert(
|
||||
&room_latest_id,
|
||||
&serde_json::to_vec(&event).expect("EduEvent::to_string always works"),
|
||||
&serde_json::to_vec(event).expect("EduEvent::to_string always works"),
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
|
|
|
@ -22,7 +22,7 @@ impl Service {
|
|||
}
|
||||
|
||||
/// Replaces the previous read receipt.
|
||||
pub fn readreceipt_update(&self, user_id: &UserId, room_id: &RoomId, event: ReceiptEvent) -> Result<()> {
|
||||
pub fn readreceipt_update(&self, user_id: &UserId, room_id: &RoomId, event: &ReceiptEvent) -> Result<()> {
|
||||
self.db.readreceipt_update(user_id, room_id, event)?;
|
||||
services().sending.flush_room(room_id)?;
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ impl Data {
|
|||
})
|
||||
}
|
||||
|
||||
pub(super) fn save_statediff(&self, shortstatehash: u64, diff: StateDiff) -> Result<()> {
|
||||
pub(super) fn save_statediff(&self, shortstatehash: u64, diff: &StateDiff) -> Result<()> {
|
||||
let mut value = diff.parent.unwrap_or(0).to_be_bytes().to_vec();
|
||||
for new in diff.added.iter() {
|
||||
value.extend_from_slice(&new[..]);
|
||||
|
|
|
@ -200,7 +200,7 @@ impl Service {
|
|||
// There is no parent layer, create a new state
|
||||
self.db.save_statediff(
|
||||
shortstatehash,
|
||||
StateDiff {
|
||||
&StateDiff {
|
||||
parent: None,
|
||||
added: statediffnew,
|
||||
removed: statediffremoved,
|
||||
|
@ -251,7 +251,7 @@ impl Service {
|
|||
// Diff small enough, we add diff as layer on top of parent
|
||||
self.db.save_statediff(
|
||||
shortstatehash,
|
||||
StateDiff {
|
||||
&StateDiff {
|
||||
parent: Some(parent.0),
|
||||
added: statediffnew,
|
||||
removed: statediffremoved,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue