refactor: apply clippy lints
cargo clippy --no-deps -- --deny clippy::nursery --deny clippy::pedantic (does not quite pass due to unused `&self` in State::subscription) I am considering ignoring events when the file picker is opened, but that isn't a very nice solution (should just make it async atp)
This commit is contained in:
parent
94c905db38
commit
9d4e24e809
2 changed files with 51 additions and 52 deletions
|
|
@ -5,9 +5,9 @@ use image::{DynamicImage, ImageDecoder, ImageReader, ImageResult, RgbaImage};
|
|||
use rfd::FileDialog;
|
||||
|
||||
pub fn load_image(path: impl AsRef<Path>) -> Result<RgbaImage, String> {
|
||||
_load_image(path).map_err(|e| e.to_string())
|
||||
load_image_impl(path).map_err(|e| e.to_string())
|
||||
}
|
||||
fn _load_image(path: impl AsRef<Path>) -> ImageResult<RgbaImage> {
|
||||
fn load_image_impl(path: impl AsRef<Path>) -> ImageResult<RgbaImage> {
|
||||
let mut decoder = ImageReader::open(path)?
|
||||
.with_guessed_format()?
|
||||
.into_decoder()?;
|
||||
|
|
@ -48,12 +48,12 @@ pub fn save_image(image: Option<&RgbaImage>) -> Result<(), String> {
|
|||
|
||||
if let Err(e) = image.save(&path) {
|
||||
return Err(e.to_string());
|
||||
};
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn string_from_filter_type(f: widget::image::FilterMethod) -> &'static str {
|
||||
pub const fn string_from_filter_type(f: widget::image::FilterMethod) -> &'static str {
|
||||
match f {
|
||||
widget::image::FilterMethod::Linear => "bilinear",
|
||||
widget::image::FilterMethod::Nearest => "nearest neighbor",
|
||||
|
|
|
|||
Loading…
Reference in a new issue