Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clippy updates #18

Merged
merged 2 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/hsl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ impl Hsl {

#[must_use]
#[inline(always)]
#[allow(clippy::missing_const_for_fn)]
pub fn into_data(self) -> Vec<[f32; 3]> {
self.data
}
Expand Down
1 change: 0 additions & 1 deletion src/linear_rgb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ impl LinearRgb {

#[must_use]
#[inline(always)]
#[allow(clippy::missing_const_for_fn)]
pub fn into_data(self) -> Vec<[f32; 3]> {
self.data
}
Expand Down
1 change: 0 additions & 1 deletion src/rgb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ impl Rgb {

#[must_use]
#[inline(always)]
#[allow(clippy::missing_const_for_fn)]
pub fn into_data(self) -> Vec<[f32; 3]> {
self.data
}
Expand Down
10 changes: 7 additions & 3 deletions src/rgb_xyb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ mod tests {
let input = fs::read_to_string(path).unwrap();
input
.lines()
.map(|l| l.trim())
.map(str::trim)
.filter(|l| !l.is_empty())
.map(|l| {
let (x, l) = l.split_once(' ').unwrap();
Expand All @@ -168,7 +168,7 @@ mod tests {
let expected_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("test_data")
.join("tank_xyb.txt");
let source = image::open(&source_path).unwrap();
let source = image::open(source_path).unwrap();
let source_data = source
.to_rgb32f()
.chunks_exact(3)
Expand Down Expand Up @@ -217,7 +217,11 @@ mod tests {
.join("tank_srgb.png");
let source_data = parse_xyb_txt(&source_path);
let source = Xyb::new(source_data, 1448, 1080).unwrap();
let expected = image::open(&expected_path).unwrap();
let expected = image::open(expected_path).unwrap();

// Fixing this would result in worse code, and this
// needless collect() doesn't really matter in tests
#[allow(clippy::needless_collect)]
let expected_data = expected
.to_rgb32f()
.chunks_exact(3)
Expand Down
1 change: 0 additions & 1 deletion src/xyb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ impl Xyb {

#[must_use]
#[inline(always)]
#[allow(clippy::missing_const_for_fn)]
pub fn into_data(self) -> Vec<[f32; 3]> {
self.data
}
Expand Down
4 changes: 4 additions & 0 deletions src/yuv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ impl<T: Pixel> Yuv<T> {
/// frame data
/// - If `data` contains values which are not valid for the specified bit
/// depth (note: out-of-range values for limited range are allowed)
// Clippy complains about T::to_u16 maybe panicking, but it can be assumed
// to never panic because the Pixel trait is only implemented by u8 and
// u16, both of which will successfully return a u16 from to_u16.
#[allow(clippy::missing_panics_doc)]
pub fn new(data: Frame<T>, config: YuvConfig) -> Result<Self, YuvError> {
if config.subsampling_x != data.planes[1].cfg.xdec as u8
|| config.subsampling_x != data.planes[2].cfg.xdec as u8
Expand Down
Loading