Skip to content

Commit

Permalink
Clippy updates (#18)
Browse files Browse the repository at this point in the history
* Remove clippy allows (bug seems to be fixed)

* Fix new clippy warnings/errors
  • Loading branch information
FreezyLemon authored Jan 30, 2024
1 parent 153dcb8 commit 15ec060
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
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

0 comments on commit 15ec060

Please sign in to comment.