fix use std::mem related lint

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-06-16 00:10:53 +00:00
parent 48d9677959
commit 0923b6f428
3 changed files with 7 additions and 7 deletions

View file

@ -1,4 +1,4 @@
use std::{mem, sync::Arc};
use std::{mem::size_of, sync::Arc};
use ruma::{EventId, RoomId, UserId};
@ -44,7 +44,7 @@ impl Data for KeyValueDatabase {
.iter_from(&current, true)
.take_while(move |(k, _)| k.starts_with(&prefix))
.map(move |(tofrom, _data)| {
let from = utils::u64_from_bytes(&tofrom[(mem::size_of::<u64>())..])
let from = utils::u64_from_bytes(&tofrom[(size_of::<u64>())..])
.map_err(|_| Error::bad_database("Invalid count in tofrom_relation."))?;
let mut pduid = shortroomid.to_be_bytes().to_vec();

View file

@ -1,4 +1,4 @@
use std::mem;
use std::mem::size_of;
use ruma::{
events::{receipt::ReceiptEvent, AnySyncEphemeralRoomEvent},
@ -86,10 +86,10 @@ impl Data for KeyValueDatabase {
.iter_from(&first_possible_edu, false)
.take_while(move |(k, _)| k.starts_with(&prefix2))
.map(move |(k, v)| {
let count = utils::u64_from_bytes(&k[prefix.len()..prefix.len() + mem::size_of::<u64>()])
let count = utils::u64_from_bytes(&k[prefix.len()..prefix.len() + size_of::<u64>()])
.map_err(|_| Error::bad_database("Invalid readreceiptid count in db."))?;
let user_id = UserId::parse(
utils::string_from_bytes(&k[prefix.len() + mem::size_of::<u64>() + 1..])
utils::string_from_bytes(&k[prefix.len() + size_of::<u64>() + 1..])
.map_err(|_| Error::bad_database("Invalid readreceiptid userid bytes in db."))?,
)
.map_err(|_| Error::bad_database("Invalid readreceiptid userid in db."))?;

View file

@ -1,4 +1,4 @@
use std::mem;
use std::mem::size_of;
use ruma::{api::client::threads::get_threads::v1::IncludeThreads, OwnedUserId, RoomId, UserId};
@ -35,7 +35,7 @@ impl Data for KeyValueDatabase {
.iter_from(&current, true)
.take_while(move |(k, _)| k.starts_with(&prefix))
.map(move |(pduid, _users)| {
let count = utils::u64_from_bytes(&pduid[(mem::size_of::<u64>())..])
let count = utils::u64_from_bytes(&pduid[(size_of::<u64>())..])
.map_err(|_| Error::bad_database("Invalid pduid in threadid_userids."))?;
let mut pdu = services()
.rooms