cargo fmt

This commit is contained in:
Vincent Prouillet 2021-06-09 14:14:01 +02:00
parent 9145af6b3e
commit 38ddb1c4d1
2 changed files with 4 additions and 6 deletions

View file

@ -555,7 +555,7 @@ impl From<ImageMeta> 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<P: AsRef<Path>>(path: P) -> Result<ImageMetaResponse>
// 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())),
}

View file

@ -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();