Skip to content

Commit b2cbf62

Browse files
style(cli): format path-based decoding
1 parent 47a2018 commit b2cbf62

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎crates/pixl-cli/src/main.rs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ fn format_for_path(path: &str, bytes: &[u8]) -> Option<Format> {
7777

7878
fn read_image(path: &str, limits: Limits) -> Result<(Image, Vec<u8>), String> {
7979
let bytes = std::fs::read(path).map_err(|e| format!("{path}: {e}"))?;
80-
let format = format_for_path(path, &bytes).ok_or_else(|| format!("{path}: cannot detect image format"))?;
81-
let image = decode_with_format(&bytes, format, limits).map_err(|e| format!("{path}: {e}"))?;
80+
let format = format_for_path(path, &bytes)
81+
.ok_or_else(|| format!("{path}: cannot detect image format"))?;
82+
let image = decode_with_format(&bytes, format, limits)
83+
.map_err(|e| format!("{path}: {e}"))?;
8284
Ok((image, bytes))
8385
}
8486

0 commit comments

Comments
 (0)