1From 1764d169bd1e05354336a4b1f07b6345a760a556 Mon Sep 17 00:00:00 2001
2From: Lukasz Anforowicz <[email protected]>
3Date: Thu, 3 Oct 2024 20:07:16 +0000
4Subject: [PATCH 105/113] Fix a subset of issues identified by `cargo clippy`.
5
6---
7 src/decoder/stream.rs            | 6 ++----
8 src/decoder/transform.rs         | 8 ++++----
9 src/decoder/transform/palette.rs | 4 ++--
10 src/encoder.rs                   | 1 -
11 4 files changed, 8 insertions(+), 11 deletions(-)
12
13diff --git a/third_party/rust/chromium_crates_io/vendor/png-0.17.14/src/decoder/stream.rs b/third_party/rust/chromium_crates_io/vendor/png-0.17.14/src/decoder/stream.rs
14index 2607078..f52523a 100644
15--- a/third_party/rust/chromium_crates_io/vendor/png-0.17.14/src/decoder/stream.rs
16+++ b/third_party/rust/chromium_crates_io/vendor/png-0.17.14/src/decoder/stream.rs
17@@ -958,7 +958,7 @@ impl StreamingDecoder {
18             _ => Ok(Decoded::PartialChunk(type_str)),
19         };
20
21-        let parse_result = parse_result.map_err(|e| {
22+        parse_result.map_err(|e| {
23             self.state = None;
24             match e {
25                 // `parse_chunk` is invoked after gathering **all** bytes of a chunk, so
26@@ -972,9 +972,7 @@ impl StreamingDecoder {
27                 }
28                 e => e,
29             }
30-        });
31-
32-        parse_result
33+        })
34     }
35
36     fn parse_fctl(&mut self) -> Result<Decoded, DecodingError> {
37diff --git a/third_party/rust/chromium_crates_io/vendor/png-0.17.14/src/decoder/transform.rs b/third_party/rust/chromium_crates_io/vendor/png-0.17.14/src/decoder/transform.rs
38index e7de03e..f2b6654 100644
39--- a/third_party/rust/chromium_crates_io/vendor/png-0.17.14/src/decoder/transform.rs
40+++ b/third_party/rust/chromium_crates_io/vendor/png-0.17.14/src/decoder/transform.rs
41@@ -30,18 +30,18 @@ pub fn create_transform_fn(
42     match color_type {
43         ColorType::Indexed if expand => {
44             if info.palette.is_none() {
45-                return Err(DecodingError::Format(
46+                Err(DecodingError::Format(
47                     FormatErrorInner::PaletteRequired.into(),
48-                ));
49+                ))
50             } else if let BitDepth::Sixteen = info.bit_depth {
51                 // This should have been caught earlier but let's check again. Can't hurt.
52-                return Err(DecodingError::Format(
53+                Err(DecodingError::Format(
54                     FormatErrorInner::InvalidColorBitDepth {
55                         color_type: ColorType::Indexed,
56                         bit_depth: BitDepth::Sixteen,
57                     }
58                     .into(),
59-                ));
60+                ))
61             } else {
62                 Ok(if trns {
63                     palette::create_expansion_into_rgba8(info)
64diff --git a/third_party/rust/chromium_crates_io/vendor/png-0.17.14/src/decoder/transform/palette.rs b/third_party/rust/chromium_crates_io/vendor/png-0.17.14/src/decoder/transform/palette.rs
65index 329c7bd..7508913 100644
66--- a/third_party/rust/chromium_crates_io/vendor/png-0.17.14/src/decoder/transform/palette.rs
67+++ b/third_party/rust/chromium_crates_io/vendor/png-0.17.14/src/decoder/transform/palette.rs
68@@ -70,7 +70,7 @@ fn create_rgba_palette(info: &Info) -> [[u8; 4]; 256] {
69             palette_iter = &palette_iter[3..];
70             rgba_iter = &mut rgba_iter[1..];
71         }
72-        if palette_iter.len() > 0 {
73+        if !palette_iter.is_empty() {
74             rgba_iter[0][0..3].copy_from_slice(&palette_iter[0..3]);
75         }
76     }
77@@ -99,7 +99,7 @@ fn expand_8bit_into_rgb8(mut input: &[u8], mut output: &mut [u8], rgba_palette:
78         input = &input[1..];
79         output = &mut output[3..];
80     }
81-    if output.len() > 0 {
82+    if !output.is_empty() {
83         let rgba = &rgba_palette[input[0] as usize];
84         output[0..3].copy_from_slice(&rgba[0..3]);
85     }
86diff --git a/third_party/rust/chromium_crates_io/vendor/png-0.17.14/src/encoder.rs b/third_party/rust/chromium_crates_io/vendor/png-0.17.14/src/encoder.rs
87index 73e0f1e..d694f76 100644
88--- a/third_party/rust/chromium_crates_io/vendor/png-0.17.14/src/encoder.rs
89+++ b/third_party/rust/chromium_crates_io/vendor/png-0.17.14/src/encoder.rs
90@@ -317,7 +317,6 @@ impl<'a, W: Write> Encoder<'a, W> {
91     /// based on heuristics which minimize the file size for compression rather
92     /// than use a single filter for the entire image. The default method is
93     /// [`AdaptiveFilterType::NonAdaptive`].
94-
95     pub fn set_adaptive_filter(&mut self, adaptive_filter: AdaptiveFilterType) {
96         self.options.adaptive_filter = adaptive_filter;
97     }
98--
992.47.0.rc0.187.ge670bccf7e-goog
100
101