Skip to content

Commit 118a58b

Browse files
authored
Fix clippy issues and stop it from breaking with every Rust update (#929)
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`.
1 parent f88cc27 commit 118a58b

File tree

5 files changed

+11
-30
lines changed

5 files changed

+11
-30
lines changed

av1an-core/src/context.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -733,14 +733,13 @@ impl Av1anContext {
733733
let zones = self.parse_zones()?;
734734

735735
// Create a new input with the generated VapourSynth script for Scene Detection
736-
let input = if let Some(ref vs_script) = self.vs_script {
737-
Input::VapourSynth {
736+
let input = self.vs_script.as_ref().map_or_else(
737+
|| self.args.input.clone(),
738+
|vs_script| Input::VapourSynth {
738739
path: vs_script.clone(),
739740
vspipe_args: Vec::new(),
740-
}
741-
} else {
742-
self.args.input.clone()
743-
};
741+
},
742+
);
744743

745744
Ok(match self.args.split_method {
746745
SplitMethod::AvScenechange => av_scenechange_detect(

av1an-core/src/encoder.rs

+1
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,7 @@ impl Encoder {
820820
}
821821
}
822822

823+
#[allow(clippy::too_many_arguments)]
823824
/// Constructs tuple of commands for target quality probing
824825
pub fn probe_cmd(
825826
self,

av1an-core/src/lib.rs

+1-23
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,3 @@
1-
#![warn(clippy::all, clippy::pedantic, clippy::nursery)]
2-
#![allow(clippy::missing_errors_doc)]
3-
#![allow(clippy::missing_panics_doc)]
4-
#![allow(clippy::cast_possible_truncation)]
5-
#![allow(clippy::cast_sign_loss)]
6-
#![allow(clippy::cast_precision_loss)]
7-
#![allow(clippy::must_use_candidate)]
8-
#![allow(clippy::too_many_arguments)]
9-
#![allow(clippy::too_many_lines)]
10-
#![allow(clippy::cast_possible_wrap)]
11-
#![allow(clippy::if_not_else)]
12-
#![allow(clippy::module_name_repetitions)]
13-
#![allow(clippy::doc_markdown)]
14-
#![allow(clippy::items_after_statements)]
15-
#![allow(clippy::wildcard_imports)]
16-
#![allow(clippy::unsafe_derive_deserialize)]
17-
#![allow(clippy::needless_pass_by_value)]
18-
#![allow(clippy::use_self)]
19-
201
#[macro_use]
212
extern crate log;
223

@@ -123,10 +104,7 @@ impl Input {
123104
ffmpeg::num_frames(path.as_path()).map_err(|_| anyhow::anyhow!(FAIL_MSG))?
124105
}
125106
path => vapoursynth::num_frames(
126-
vs_script_path
127-
.as_ref()
128-
.map(|p| p.as_path())
129-
.unwrap_or(path.as_path()),
107+
vs_script_path.as_deref().unwrap_or(path.as_path()),
130108
self.as_vspipe_args_map()?,
131109
)
132110
.map_err(|_| anyhow::anyhow!(FAIL_MSG))?,

av1an-core/src/scene_detect.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use crate::scenes::Scene;
1616
use crate::{into_smallvec, progress_bar, Encoder, Input, ScenecutMethod, Verbosity};
1717

1818
#[tracing::instrument]
19+
#[allow(clippy::too_many_arguments)]
1920
pub fn av_scenechange_detect(
2021
input: &Input,
2122
encoder: Encoder,
@@ -73,7 +74,7 @@ pub fn av_scenechange_detect(
7374
}
7475

7576
/// Detect scene changes using rav1e scene detector.
76-
#[allow(clippy::option_if_let_else)]
77+
#[allow(clippy::too_many_arguments)]
7778
pub fn scene_detect(
7879
input: &Input,
7980
encoder: Encoder,

av1an-core/src/vmaf.rs

+2
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ pub fn validate_libvmaf() -> anyhow::Result<()> {
114114
Ok(())
115115
}
116116

117+
#[allow(clippy::too_many_arguments)]
117118
pub fn plot(
118119
encoded: &Path,
119120
reference: &Input,
@@ -174,6 +175,7 @@ pub fn plot(
174175
Ok(())
175176
}
176177

178+
#[allow(clippy::too_many_arguments)]
177179
pub fn run_vmaf(
178180
encoded: &Path,
179181
reference_pipe_cmd: &[impl AsRef<OsStr>],

0 commit comments

Comments
 (0)