use .keys() and remove unneccery .to_vec()
This commit is contained in:
parent
804105479c
commit
ff841b73c5
|
@ -16,7 +16,7 @@ pub mod users;
|
|||
use crate::{utils, Error, Result};
|
||||
use abstraction::DatabaseEngine;
|
||||
use directories::ProjectDirs;
|
||||
use log::{error, info};
|
||||
use log::error;
|
||||
use rocket::futures::{channel::mpsc, stream::FuturesUnordered, StreamExt};
|
||||
use ruma::{DeviceId, ServerName, UserId};
|
||||
use serde::Deserialize;
|
||||
|
|
|
@ -108,7 +108,7 @@ impl Media {
|
|||
|
||||
let mut iter = self.mediaid_file.scan_prefix(prefix);
|
||||
if let Some((key, _)) = iter.next() {
|
||||
let path = globals.get_media_file(&key.to_vec());
|
||||
let path = globals.get_media_file(&key);
|
||||
let mut file = vec![];
|
||||
File::open(path).await?.read_to_end(&mut file).await?;
|
||||
let mut parts = key.rsplit(|&b| b == 0xff);
|
||||
|
@ -197,7 +197,7 @@ impl Media {
|
|||
|
||||
if let Some((key, _)) = self.mediaid_file.scan_prefix(thumbnail_prefix).next() {
|
||||
// Using saved thumbnail
|
||||
let path = globals.get_media_file(&key.to_vec());
|
||||
let path = globals.get_media_file(&key);
|
||||
let mut file = vec![];
|
||||
File::open(path).await?.read_to_end(&mut file).await?;
|
||||
let mut parts = key.rsplit(|&b| b == 0xff);
|
||||
|
@ -232,7 +232,7 @@ impl Media {
|
|||
}))
|
||||
} else if let Some((key, _)) = self.mediaid_file.scan_prefix(original_prefix).next() {
|
||||
// Generate a thumbnail
|
||||
let path = globals.get_media_file(&key.to_vec());
|
||||
let path = globals.get_media_file(&key);
|
||||
let mut file = vec![];
|
||||
File::open(path).await?.read_to_end(&mut file).await?;
|
||||
|
||||
|
|
Loading…
Reference in New Issue