remove unneeded cloning

This commit is contained in:
2020-12-23 15:35:38 +01:00
parent 901b0d8a4d
commit 5099454991
2 changed files with 8 additions and 8 deletions

View File

@@ -4,14 +4,14 @@ use regex::bytes::{Regex, RegexBuilder};
use serde::Deserialize;
use std::path::{Path, PathBuf};
#[derive(Clone, Debug)]
#[derive(Debug)]
pub struct Config {
pub from: PathBuf,
pub to: PathBuf,
pub matches: Vec<TranscodeMatch>,
}
#[derive(Clone, Debug)]
#[derive(Debug)]
pub struct TranscodeMatch {
pub regexes: Vec<Regex>,
pub to: Transcode,

View File

@@ -174,18 +174,18 @@ async fn main_loop(ui_queue: ui::MsgQueue) -> Result<()> {
stream::iter(conv_args.into_iter().enumerate())
.map(Ok)
.try_for_each_concurrent(num_cpus::get(), |(i, args)| {
let config = config.clone();
let msg_queue = ui_queue.clone();
let config = &config;
let ui_queue = &ui_queue;
let log_path = &log_path;
async move {
msg_queue.push(ui::Msg::TaskStart {
ui_queue.push(ui::Msg::TaskStart {
id: i,
args: args.clone(),
});
match transcode(&config, &args, i, &msg_queue).await {
Ok(()) => msg_queue.push(ui::Msg::TaskEnd { id: i }),
match transcode(config, &args, i, ui_queue).await {
Ok(()) => ui_queue.push(ui::Msg::TaskEnd { id: i }),
Err(err) => {
let err = err.context(format!(
"failed transcoding \"{}\"",
@@ -218,7 +218,7 @@ async fn main_loop(ui_queue: ui::MsgQueue) -> Result<()> {
})
.await?;
msg_queue.push(ui::Msg::TaskError { id: i });
ui_queue.push(ui::Msg::TaskError { id: i });
}
}