From ae6e2edafab9c7e2a646476f062cf193b78921d1 Mon Sep 17 00:00:00 2001 From: Breval Ferrari Date: Sat, 5 Apr 2025 20:02:44 -0400 Subject: [PATCH] unwrap infaillible --- bong/Cargo.toml | 1 + bong/src/main.rs | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bong/Cargo.toml b/bong/Cargo.toml index 4a4018a..9ca1b29 100644 --- a/bong/Cargo.toml +++ b/bong/Cargo.toml @@ -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" diff --git a/bong/src/main.rs b/bong/src/main.rs index 589f1bd..ad90fba 100644 --- a/bong/src/main.rs +++ b/bong/src/main.rs @@ -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::((), Default::default()) .map_err(|e| anyhow!("parsing PDF: {e}"))? - .bend_into::((), Default::default())?; + .bend_into::((), Default::default()) + .unwrap_infallible(); let dimensions = { let c = bytes.len().isqrt().try_into().context("image too big")?; Dimensions {