unwrap infaillible

This commit is contained in:
Breval Ferrari 2025-04-05 20:02:44 -04:00
parent b00ce70504
commit ae6e2edafa
No known key found for this signature in database
GPG key ID: F71E304D6400AB8E
2 changed files with 5 additions and 2 deletions

View file

@ -14,3 +14,4 @@ keywords.workspace = true
anyhow = "1.0.97"
bingus = { path = "../bingus" }
clap = { version = "4.5.32", features = ["derive"] }
unwrap-infallible = "0.1.5"

View file

@ -3,11 +3,12 @@ use std::fs::File;
use anyhow::{anyhow, Context, Error};
use bingus::{
doc::printpdf::PdfDocument,
img::{Dimensions, GrayImage, RgbImage},
img::{Dimensions, GrayImage},
Bendable, Bytes,
};
use clap::Parser;
use cli::Cli;
use unwrap_infallible::UnwrapInfallible;
mod cli;
@ -17,7 +18,8 @@ fn main() -> Result<(), Error> {
.context("opening file")?
.bend_into::<PdfDocument>((), Default::default())
.map_err(|e| anyhow!("parsing PDF: {e}"))?
.bend_into::<Bytes>((), Default::default())?;
.bend_into::<Bytes>((), Default::default())
.unwrap_infallible();
let dimensions = {
let c = bytes.len().isqrt().try_into().context("image too big")?;
Dimensions {