refactor: make cargo clippy happier

This commit is contained in:
timokoesters 2020-05-11 12:33:25 +02:00
parent 1dbde0e1c1
commit 8e041f90dd
No known key found for this signature in database
GPG key ID: 24DA7517711A2BA4
6 changed files with 23 additions and 31 deletions

View file

@ -33,13 +33,12 @@ impl AccountData {
.rev()
.filter_map(|r| r.ok())
.take_while(|key| key.starts_with(&prefix))
.filter(|key| {
.find(|key| {
key.split(|&b| b == 0xff)
.nth(1)
.filter(|&user| user == user_id.to_string().as_bytes())
.is_some()
})
.next()
{
// This is the old room_latest
self.roomuserdataid_accountdata.remove(old)?;

View file

@ -261,14 +261,14 @@ impl Rooms {
self.pduid_pdu.insert(&pdu_id, &*pdu_json.to_string())?;
self.eventid_pduid
.insert(pdu.event_id.to_string(), pdu_id.clone())?;
.insert(pdu.event_id.to_string(), pdu_id)?;
if let Some(state_key) = pdu.state_key {
let mut key = room_id.to_string().as_bytes().to_vec();
key.push(0xff);
key.extend_from_slice(pdu.kind.to_string().as_bytes());
key.push(0xff);
key.extend_from_slice(state_key.to_string().as_bytes());
key.extend_from_slice(state_key.as_bytes());
self.roomstateid_pdu.insert(key, &*pdu_json.to_string())?;
}