diff --git a/Cargo.toml b/Cargo.toml index 67ee8403..d6e91984 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,6 @@ [workspace] members = ["av1an-core", "av1an"] +resolver = "2" [profile.dev.package.av-scenechange] opt-level = 3 diff --git a/av1an-core/src/context.rs b/av1an-core/src/context.rs index f9b35f80..e5ad45bd 100644 --- a/av1an-core/src/context.rs +++ b/av1an-core/src/context.rs @@ -317,7 +317,7 @@ impl Av1anContext { // Queue::encoding_loop only sends a message if there was an error (meaning a chunk crashed) // more than MAX_TRIES. So, we have to explicitly exit the program if that happens. - while rx.recv().is_ok() { + if rx.recv().is_ok() { exit(1); } diff --git a/av1an-core/src/progress_bar.rs b/av1an-core/src/progress_bar.rs index c301ce8b..6637a74b 100644 --- a/av1an-core/src/progress_bar.rs +++ b/av1an-core/src/progress_bar.rs @@ -174,7 +174,7 @@ pub fn finish_progress_bar() { } if let Some((_, pbs)) = MULTI_PROGRESS_BAR.get() { - for pb in pbs.iter() { + for pb in pbs { pb.finish(); } } diff --git a/av1an-core/src/split.rs b/av1an-core/src/split.rs index ffc15e76..18aecdf5 100644 --- a/av1an-core/src/split.rs +++ b/av1an-core/src/split.rs @@ -63,7 +63,7 @@ pub fn extra_splits(scenes: &[Scene], total_frames: usize, split_size: usize) -> ); } - for scene in scenes.iter() { + for scene in scenes { let distance = scene.end_frame - scene.start_frame; let split_size = scene .zone_overrides diff --git a/av1an-core/src/util.rs b/av1an-core/src/util.rs index 2fcd2320..2ea01061 100644 --- a/av1an-core/src/util.rs +++ b/av1an-core/src/util.rs @@ -100,7 +100,7 @@ macro_rules! into_smallvec { macro_rules! create_dir { ($loc:expr) => { match std::fs::create_dir(&$loc) { - Ok(_) => Ok(()), + Ok(()) => Ok(()), Err(e) => match e.kind() { std::io::ErrorKind::AlreadyExists => Ok(()), _ => { diff --git a/av1an-core/src/vapoursynth.rs b/av1an-core/src/vapoursynth.rs index 07a05791..82febc85 100644 --- a/av1an-core/src/vapoursynth.rs +++ b/av1an-core/src/vapoursynth.rs @@ -74,7 +74,7 @@ pub fn best_available_chunk_method() -> ChunkMethod { } } -fn get_clip_info(env: &mut Environment) -> VideoInfo { +fn get_clip_info(env: &Environment) -> VideoInfo { // Get the output node. const OUTPUT_INDEX: i32 = 0; @@ -88,7 +88,7 @@ fn get_clip_info(env: &mut Environment) -> VideoInfo { /// Get the number of frames from an environment that has already been /// evaluated on a script. -fn get_num_frames(env: &mut Environment) -> anyhow::Result { +fn get_num_frames(env: &Environment) -> anyhow::Result { let info = get_clip_info(env); let num_frames = { @@ -123,7 +123,7 @@ fn get_num_frames(env: &mut Environment) -> anyhow::Result { Ok(num_frames) } -fn get_frame_rate(env: &mut Environment) -> anyhow::Result { +fn get_frame_rate(env: &Environment) -> anyhow::Result { let info = get_clip_info(env); match info.framerate { @@ -134,7 +134,7 @@ fn get_frame_rate(env: &mut Environment) -> anyhow::Result { /// Get the bit depth from an environment that has already been /// evaluated on a script. -fn get_bit_depth(env: &mut Environment) -> anyhow::Result { +fn get_bit_depth(env: &Environment) -> anyhow::Result { let info = get_clip_info(env); let bits_per_sample = { @@ -151,7 +151,7 @@ fn get_bit_depth(env: &mut Environment) -> anyhow::Result { /// Get the resolution from an environment that has already been /// evaluated on a script. -fn get_resolution(env: &mut Environment) -> anyhow::Result<(u32, u32)> { +fn get_resolution(env: &Environment) -> anyhow::Result<(u32, u32)> { let info = get_clip_info(env); let resolution = { @@ -168,7 +168,7 @@ fn get_resolution(env: &mut Environment) -> anyhow::Result<(u32, u32)> { /// Get the transfer characteristics from an environment that has already been /// evaluated on a script. -fn get_transfer(env: &mut Environment) -> anyhow::Result { +fn get_transfer(env: &Environment) -> anyhow::Result { // Get the output node. const OUTPUT_INDEX: i32 = 0; @@ -227,8 +227,7 @@ pub fn create_vs_file( format!( "from vapoursynth import core\n\ core.max_cache_size=1024\n\ - core.dgdecodenv.DGSource(source={:?}).set_output()", - dgindex_path + core.dgdecodenv.DGSource(source={dgindex_path:?}).set_output()" ) .as_bytes(), )?; @@ -237,8 +236,7 @@ pub fn create_vs_file( format!( "from vapoursynth import core\n\ core.max_cache_size=1024\n\ - core.bs.VideoSource({:?}, cachepath={:?}).set_output()", - source, cache_file + core.bs.VideoSource({source:?}, cachepath={cache_file:?}).set_output()" ) .as_bytes(), )?; @@ -273,7 +271,7 @@ pub fn num_frames(source: &Path) -> anyhow::Result { .eval_file(source, EvalFlags::SetWorkingDir) .unwrap(); - get_num_frames(&mut environment) + get_num_frames(&environment) } pub fn bit_depth(source: &Path) -> anyhow::Result { @@ -285,7 +283,7 @@ pub fn bit_depth(source: &Path) -> anyhow::Result { .eval_file(source, EvalFlags::SetWorkingDir) .unwrap(); - get_bit_depth(&mut environment) + get_bit_depth(&environment) } pub fn frame_rate(source: &Path) -> anyhow::Result { @@ -297,7 +295,7 @@ pub fn frame_rate(source: &Path) -> anyhow::Result { .eval_file(source, EvalFlags::SetWorkingDir) .unwrap(); - get_frame_rate(&mut environment) + get_frame_rate(&environment) } pub fn resolution(source: &Path) -> anyhow::Result<(u32, u32)> { @@ -309,7 +307,7 @@ pub fn resolution(source: &Path) -> anyhow::Result<(u32, u32)> { .eval_file(source, EvalFlags::SetWorkingDir) .unwrap(); - get_resolution(&mut environment) + get_resolution(&environment) } /// Transfer characteristics as specified in ITU-T H.265 Table E.4. @@ -322,7 +320,7 @@ pub fn transfer_characteristics(source: &Path) -> anyhow::Result { .eval_file(source, EvalFlags::SetWorkingDir) .unwrap(); - get_transfer(&mut environment) + get_transfer(&environment) } pub fn pixel_format(source: &Path) -> anyhow::Result { @@ -334,7 +332,7 @@ pub fn pixel_format(source: &Path) -> anyhow::Result { .eval_file(source, EvalFlags::SetWorkingDir) .unwrap(); - let info = get_clip_info(&mut environment); + let info = get_clip_info(&environment); match info.format { Property::Variable => bail!("Variable pixel format not supported"), Property::Constant(x) => Ok(x.name().to_string()),