From 38ddb1c4d130dec27affe64a9a22a8f12eb0dc99 Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Wed, 9 Jun 2021 14:14:01 +0200 Subject: [PATCH] cargo fmt --- components/imageproc/src/lib.rs | 9 ++++----- components/imageproc/tests/resize_image.rs | 1 - 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/components/imageproc/src/lib.rs b/components/imageproc/src/lib.rs index 4bb0dded..4d6328a4 100644 --- a/components/imageproc/src/lib.rs +++ b/components/imageproc/src/lib.rs @@ -555,7 +555,7 @@ impl From for ImageMetaResponse { Self { width: im.size.0, height: im.size.1, - format: im.format.and_then(|f| f.extensions_str().get(0)).map(|&f| f), + format: im.format.and_then(|f| f.extensions_str().get(0)).copied(), } } } @@ -589,10 +589,9 @@ pub fn read_image_metadata>(path: P) -> Result // Unfortunatelly we have to load the entire image here, unlike with the others :| let data = fs::read(path).map_err(|e| error(e.into()))?; let decoder = webp::Decoder::new(&data[..]); - decoder - .decode() - .map(ImageMetaResponse::from) - .ok_or_else(|| Error::msg(format!("Failed to decode WebP image: {}", path.display()))) + decoder.decode().map(ImageMetaResponse::from).ok_or_else(|| { + Error::msg(format!("Failed to decode WebP image: {}", path.display())) + }) } _ => ImageMeta::read(path).map(ImageMetaResponse::from).map_err(|e| error(e.into())), } diff --git a/components/imageproc/tests/resize_image.rs b/components/imageproc/tests/resize_image.rs index c19cf1f4..0e0e8f37 100644 --- a/components/imageproc/tests/resize_image.rs +++ b/components/imageproc/tests/resize_image.rs @@ -17,7 +17,6 @@ build_search_index = false highlight_code = false "#; - lazy_static! { static ref TEST_IMGS: PathBuf = [env!("CARGO_MANIFEST_DIR"), "tests", "test_imgs"].iter().collect();