Skip to content

Commit

Permalink
Fix clippy issues and stop it from breaking with every Rust update
Browse files Browse the repository at this point in the history
The lints in `nursery` and `pedantic` are not intended to be stable,
and many of them will be added or changed with each Rust update.
This makes it annoying to maintain the package, because CI will
begin failing every 6 weeks when a new Rust version releases.
This cleans up this version's new pedantic lints, and then removes
our overrides that enable the unstable lints.

It looks like this was already done in the `av1an` package a while ago,
but we never did it for `av1an-core`.
  • Loading branch information
shssoichiro committed Mar 8, 2025
1 parent f88cc27 commit 4acf9f5
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 30 deletions.
11 changes: 5 additions & 6 deletions av1an-core/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -733,14 +733,13 @@ impl Av1anContext {
let zones = self.parse_zones()?;

// Create a new input with the generated VapourSynth script for Scene Detection
let input = if let Some(ref vs_script) = self.vs_script {
Input::VapourSynth {
let input = self.vs_script.as_ref().map_or_else(
|| self.args.input.clone(),
|vs_script| Input::VapourSynth {
path: vs_script.clone(),
vspipe_args: Vec::new(),
}
} else {
self.args.input.clone()
};
},
);

Ok(match self.args.split_method {
SplitMethod::AvScenechange => av_scenechange_detect(
Expand Down
1 change: 1 addition & 0 deletions av1an-core/src/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,7 @@ impl Encoder {
}
}

#[allow(clippy::too_many_arguments)]
/// Constructs tuple of commands for target quality probing
pub fn probe_cmd(
self,
Expand Down
24 changes: 1 addition & 23 deletions av1an-core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
#![warn(clippy::all, clippy::pedantic, clippy::nursery)]
#![allow(clippy::missing_errors_doc)]
#![allow(clippy::missing_panics_doc)]
#![allow(clippy::cast_possible_truncation)]
#![allow(clippy::cast_sign_loss)]
#![allow(clippy::cast_precision_loss)]
#![allow(clippy::must_use_candidate)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::too_many_lines)]
#![allow(clippy::cast_possible_wrap)]
#![allow(clippy::if_not_else)]
#![allow(clippy::module_name_repetitions)]
#![allow(clippy::doc_markdown)]
#![allow(clippy::items_after_statements)]
#![allow(clippy::wildcard_imports)]
#![allow(clippy::unsafe_derive_deserialize)]
#![allow(clippy::needless_pass_by_value)]
#![allow(clippy::use_self)]

#[macro_use]
extern crate log;

Expand Down Expand Up @@ -123,10 +104,7 @@ impl Input {
ffmpeg::num_frames(path.as_path()).map_err(|_| anyhow::anyhow!(FAIL_MSG))?
}
path => vapoursynth::num_frames(
vs_script_path
.as_ref()
.map(|p| p.as_path())
.unwrap_or(path.as_path()),
vs_script_path.as_deref().unwrap_or(path.as_path()),
self.as_vspipe_args_map()?,
)
.map_err(|_| anyhow::anyhow!(FAIL_MSG))?,
Expand Down
3 changes: 2 additions & 1 deletion av1an-core/src/scene_detect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use crate::scenes::Scene;
use crate::{into_smallvec, progress_bar, Encoder, Input, ScenecutMethod, Verbosity};

#[tracing::instrument]
#[allow(clippy::too_many_arguments)]
pub fn av_scenechange_detect(
input: &Input,
encoder: Encoder,
Expand Down Expand Up @@ -73,7 +74,7 @@ pub fn av_scenechange_detect(
}

/// Detect scene changes using rav1e scene detector.
#[allow(clippy::option_if_let_else)]
#[allow(clippy::too_many_arguments)]
pub fn scene_detect(
input: &Input,
encoder: Encoder,
Expand Down
2 changes: 2 additions & 0 deletions av1an-core/src/vmaf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ pub fn validate_libvmaf() -> anyhow::Result<()> {
Ok(())
}

#[allow(clippy::too_many_arguments)]
pub fn plot(
encoded: &Path,
reference: &Input,
Expand Down Expand Up @@ -174,6 +175,7 @@ pub fn plot(
Ok(())
}

#[allow(clippy::too_many_arguments)]
pub fn run_vmaf(
encoded: &Path,
reference_pipe_cmd: &[impl AsRef<OsStr>],
Expand Down

0 comments on commit 4acf9f5

Please sign in to comment.