cargo fmt
This commit is contained in:
parent
9145af6b3e
commit
38ddb1c4d1
|
@ -555,7 +555,7 @@ impl From<ImageMeta> for ImageMetaResponse {
|
||||||
Self {
|
Self {
|
||||||
width: im.size.0,
|
width: im.size.0,
|
||||||
height: im.size.1,
|
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 :|
|
// 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 data = fs::read(path).map_err(|e| error(e.into()))?;
|
||||||
let decoder = webp::Decoder::new(&data[..]);
|
let decoder = webp::Decoder::new(&data[..]);
|
||||||
decoder
|
decoder.decode().map(ImageMetaResponse::from).ok_or_else(|| {
|
||||||
.decode()
|
Error::msg(format!("Failed to decode WebP image: {}", path.display()))
|
||||||
.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())),
|
_ => ImageMeta::read(path).map(ImageMetaResponse::from).map_err(|e| error(e.into())),
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ build_search_index = false
|
||||||
highlight_code = false
|
highlight_code = false
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref TEST_IMGS: PathBuf =
|
static ref TEST_IMGS: PathBuf =
|
||||||
[env!("CARGO_MANIFEST_DIR"), "tests", "test_imgs"].iter().collect();
|
[env!("CARGO_MANIFEST_DIR"), "tests", "test_imgs"].iter().collect();
|
||||||
|
|
Loading…
Reference in a new issue