From fabe84c4e3c695f7e9f50faa3c8c2bb78f2182cc Mon Sep 17 00:00:00 2001 From: xxanqw Date: Tue, 1 Jul 2025 20:16:48 +0300 Subject: [PATCH] CI Fixes --- src/main.rs | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/src/main.rs b/src/main.rs index 3df963b..4dedd58 100644 --- a/src/main.rs +++ b/src/main.rs @@ -336,7 +336,7 @@ fn draw_miku_says(text: &str) -> Result<(), Box> { if all_lines.len() >= window_height as usize { let horizontal_padding = " ".repeat(left); for line in &all_lines { - println!("{}{}", horizontal_padding, line); + println!("{horizontal_padding}{line}"); } execute!(stdout, Show)?; return Ok(()); @@ -370,19 +370,15 @@ fn get_speech_bubble_lines(text: &str) -> Vec { let max_width = lines.iter().map(|line| line.width()).max().unwrap_or(0); let mut bubble_lines = Vec::new(); - let pointer_pos = 3; + let pointer_pos: usize = 3; let bubble_content_width = max_width + 4; let bubble_center = bubble_content_width / 2; - let bubble_start_offset = if pointer_pos >= bubble_center { - pointer_pos - bubble_center - } else { - 0 - }; + let bubble_start_offset = pointer_pos.saturating_sub(bubble_center); let padding = " ".repeat(bubble_start_offset); - bubble_lines.push(format!("{} {}", padding, "_".repeat(max_width + 2))); + bubble_lines.push(format!("{padding} {}", "_".repeat(max_width + 2))); for (i, line) in lines.iter().enumerate() { let (left_border, right_border) = if lines.len() == 1 { @@ -396,16 +392,11 @@ fn get_speech_bubble_lines(text: &str) -> Vec { }; bubble_lines.push(format!( - "{}{} {: Vec { let word_width = word.width(); let current_width = current_line.width(); - if current_width + word_width + 1 <= max_width { + if current_width + word_width < max_width { if !current_line.is_empty() { current_line.push(' '); }