fix use std::mem related lint
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
48d9677959
commit
0923b6f428
3 changed files with 7 additions and 7 deletions
|
@ -1,4 +1,4 @@
|
||||||
use std::{mem, sync::Arc};
|
use std::{mem::size_of, sync::Arc};
|
||||||
|
|
||||||
use ruma::{EventId, RoomId, UserId};
|
use ruma::{EventId, RoomId, UserId};
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ impl Data for KeyValueDatabase {
|
||||||
.iter_from(¤t, true)
|
.iter_from(¤t, true)
|
||||||
.take_while(move |(k, _)| k.starts_with(&prefix))
|
.take_while(move |(k, _)| k.starts_with(&prefix))
|
||||||
.map(move |(tofrom, _data)| {
|
.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."))?;
|
.map_err(|_| Error::bad_database("Invalid count in tofrom_relation."))?;
|
||||||
|
|
||||||
let mut pduid = shortroomid.to_be_bytes().to_vec();
|
let mut pduid = shortroomid.to_be_bytes().to_vec();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use std::mem;
|
use std::mem::size_of;
|
||||||
|
|
||||||
use ruma::{
|
use ruma::{
|
||||||
events::{receipt::ReceiptEvent, AnySyncEphemeralRoomEvent},
|
events::{receipt::ReceiptEvent, AnySyncEphemeralRoomEvent},
|
||||||
|
@ -86,10 +86,10 @@ impl Data for KeyValueDatabase {
|
||||||
.iter_from(&first_possible_edu, false)
|
.iter_from(&first_possible_edu, false)
|
||||||
.take_while(move |(k, _)| k.starts_with(&prefix2))
|
.take_while(move |(k, _)| k.starts_with(&prefix2))
|
||||||
.map(move |(k, v)| {
|
.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."))?;
|
.map_err(|_| Error::bad_database("Invalid readreceiptid count in db."))?;
|
||||||
let user_id = UserId::parse(
|
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 bytes in db."))?,
|
||||||
)
|
)
|
||||||
.map_err(|_| Error::bad_database("Invalid readreceiptid userid in db."))?;
|
.map_err(|_| Error::bad_database("Invalid readreceiptid userid in db."))?;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use std::mem;
|
use std::mem::size_of;
|
||||||
|
|
||||||
use ruma::{api::client::threads::get_threads::v1::IncludeThreads, OwnedUserId, RoomId, UserId};
|
use ruma::{api::client::threads::get_threads::v1::IncludeThreads, OwnedUserId, RoomId, UserId};
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ impl Data for KeyValueDatabase {
|
||||||
.iter_from(¤t, true)
|
.iter_from(¤t, true)
|
||||||
.take_while(move |(k, _)| k.starts_with(&prefix))
|
.take_while(move |(k, _)| k.starts_with(&prefix))
|
||||||
.map(move |(pduid, _users)| {
|
.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."))?;
|
.map_err(|_| Error::bad_database("Invalid pduid in threadid_userids."))?;
|
||||||
let mut pdu = services()
|
let mut pdu = services()
|
||||||
.rooms
|
.rooms
|
||||||
|
|
Loading…
Add table
Reference in a new issue