From 292257a5f0997e24fb8e6e08b4dccdd439b81a97 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Wed, 8 Oct 2025 16:16:49 +0800 Subject: format(image): make clippy happy --- src/image.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/image.rs b/src/image.rs index ca84b1e..ce22b90 100644 --- a/src/image.rs +++ b/src/image.rs @@ -40,6 +40,12 @@ struct MutNCOffset<'a> { y: &'a mut u32, } +impl Default for FlowChart { + fn default() -> Self { + Self::new() + } +} + impl FlowChart { // TODO: based on how much text const COMPONENT_TEXT_PADDING: u32 = 1 * Self::RESOLUTION_MULTIPLIER; @@ -190,9 +196,7 @@ impl FlowChart { self.offset .center, ); - let mut cw = c - .checked_sub(w / 2) - .unwrap_or(0); + let mut cw = c.saturating_sub(w / 2); draw_filled_rect_mut(&mut self.img, Rect::at(cw as i32, curh as i32).of_size(w, h), colors::PROCESS); self.draw_text( &wrapped, -- cgit v1.2.3