Skip to content

Commit 25db7db

Browse files
committed
refactor: Small refactor to improve code coverage
1 parent 622d185 commit 25db7db

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/decoder/image.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
use color_thief::{Color, ColorFormat};
2-
31
use std::path::Path;
42

5-
fn find_color(t: image::ColorType) -> ColorFormat {
3+
use color_thief::{Color, ColorFormat, get_palette};
4+
use image::ColorType;
5+
6+
fn find_color(t: ColorType) -> ColorFormat {
67
match t {
7-
image::ColorType::Rgb8 => ColorFormat::Rgb,
8-
image::ColorType::Rgba8 => ColorFormat::Rgba,
8+
ColorType::Rgb8 => ColorFormat::Rgb,
9+
ColorType::Rgba8 => ColorFormat::Rgba,
910
_ => unreachable!(),
1011
}
1112
}
@@ -28,8 +29,7 @@ impl<'a> Image<'a> {
2829
match image::open(&self.resolved_path()) {
2930
Ok(image) => {
3031
let color_type = find_color(image.color());
31-
let colors =
32-
color_thief::get_palette(&image.into_bytes(), color_type, 10, 10).unwrap();
32+
let colors = get_palette(&image.into_bytes(), color_type, 10, 10).unwrap();
3333

3434
Some(colors)
3535
}

0 commit comments

Comments
 (0)