mirror of
https://github.com/girlbossceo/conduwuit.git
synced 2024-11-27 11:45:23 +00:00
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 crate::{utils, Error, Result};
|
||||||
use abstraction::DatabaseEngine;
|
use abstraction::DatabaseEngine;
|
||||||
use directories::ProjectDirs;
|
use directories::ProjectDirs;
|
||||||
use log::{error, info};
|
use log::error;
|
||||||
use rocket::futures::{channel::mpsc, stream::FuturesUnordered, StreamExt};
|
use rocket::futures::{channel::mpsc, stream::FuturesUnordered, StreamExt};
|
||||||
use ruma::{DeviceId, ServerName, UserId};
|
use ruma::{DeviceId, ServerName, UserId};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
|
@ -108,7 +108,7 @@ impl Media {
|
||||||
|
|
||||||
let mut iter = self.mediaid_file.scan_prefix(prefix);
|
let mut iter = self.mediaid_file.scan_prefix(prefix);
|
||||||
if let Some((key, _)) = iter.next() {
|
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![];
|
let mut file = vec![];
|
||||||
File::open(path).await?.read_to_end(&mut file).await?;
|
File::open(path).await?.read_to_end(&mut file).await?;
|
||||||
let mut parts = key.rsplit(|&b| b == 0xff);
|
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() {
|
if let Some((key, _)) = self.mediaid_file.scan_prefix(thumbnail_prefix).next() {
|
||||||
// Using saved thumbnail
|
// Using saved thumbnail
|
||||||
let path = globals.get_media_file(&key.to_vec());
|
let path = globals.get_media_file(&key);
|
||||||
let mut file = vec![];
|
let mut file = vec![];
|
||||||
File::open(path).await?.read_to_end(&mut file).await?;
|
File::open(path).await?.read_to_end(&mut file).await?;
|
||||||
let mut parts = key.rsplit(|&b| b == 0xff);
|
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() {
|
} else if let Some((key, _)) = self.mediaid_file.scan_prefix(original_prefix).next() {
|
||||||
// Generate a thumbnail
|
// Generate a thumbnail
|
||||||
let path = globals.get_media_file(&key.to_vec());
|
let path = globals.get_media_file(&key);
|
||||||
let mut file = vec![];
|
let mut file = vec![];
|
||||||
File::open(path).await?.read_to_end(&mut file).await?;
|
File::open(path).await?.read_to_end(&mut file).await?;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue