reverse iterator funk

This commit is contained in:
Jonathan de Jong 2021-07-04 13:30:47 +02:00
parent e5a26de606
commit f81018ab2d
2 changed files with 2 additions and 10 deletions

View file

@ -189,10 +189,7 @@ impl Media {
original_prefix.extend_from_slice(&0_u32.to_be_bytes()); // Height = 0 if it's not a thumbnail
original_prefix.push(0xff);
if let Some((key, _)) = {
/* scoped to explicitly drop iterator */
self.mediaid_file.scan_prefix(thumbnail_prefix).next()
} {
if let Some((key, _)) = self.mediaid_file.scan_prefix(thumbnail_prefix).next() {
// Using saved thumbnail
let path = globals.get_media_file(&key);
let mut file = Vec::new();
@ -227,10 +224,7 @@ impl Media {
content_type,
file: file.to_vec(),
}))
} else if let Some((key, _)) = {
/* scoped to explicitly drop iterator */
self.mediaid_file.scan_prefix(original_prefix).next()
} {
} else if let Some((key, _)) = self.mediaid_file.scan_prefix(original_prefix).next() {
// Generate a thumbnail
let path = globals.get_media_file(&key);
let mut file = Vec::new();

View file

@ -733,8 +733,6 @@ impl Rooms {
.filter(|user_id| user_id.server_name() == db.globals.server_name())
.filter(|user_id| !db.users.is_deactivated(user_id).unwrap_or(false))
.filter(|user_id| self.is_joined(&user_id, &pdu.room_id).unwrap_or(false))
.collect::<Vec<_>>()
/* to consume iterator */
{
// Don't notify the user of their own events
if user == pdu.sender {