Skip to content

Commit

Permalink
No need for ProcessTask to be boxed
Browse files Browse the repository at this point in the history
  • Loading branch information
szeweq committed Sep 29, 2023
1 parent 1b5aa8f commit 3847ab3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/bin/mc-repack/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{fs, io, path::{PathBuf, Path}, thread::{self, JoinHandle}, any::Any, error::Error};
use std::{fs, io, path::{PathBuf, Path}, thread::{self, JoinHandle}, any::Any};

use clap::Parser;
use crossbeam_channel::Sender;
Expand Down Expand Up @@ -29,10 +29,10 @@ fn process_task_from(ca: cli_args::Args) -> io::Result<()> {
let cli_args::Args { silent, use_blacklist, ..} = ca;
let fmeta = ca.path.metadata()?;
let ropts = RepackOpts { silent, use_blacklist };
let task: Box<dyn ProcessTask> = if fmeta.is_dir() {
Box::new(JarDirRepackTask)
let task: &dyn ProcessTask = if fmeta.is_dir() {
&JarDirRepackTask
} else if fmeta.is_file() {
Box::new(JarRepackTask)
&JarRepackTask
} else {
return Err(new_io_error("Not a file or directory"))
};
Expand Down

0 comments on commit 3847ab3

Please sign in to comment.