From acbf47f381247f5b9aa355f09a8cbcab2251f33f Mon Sep 17 00:00:00 2001 From: RivoLink Date: Thu, 12 Nov 2026 22:49:05 +0300 Subject: [PATCH] fix: new clippy ci errors --- src/app/text_copy.rs | 6 +++--- src/cli.rs | 6 +----- src/tests/render.rs | 8 ++++---- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/app/text_copy.rs b/src/app/text_copy.rs index 66a72aa..93234bb 100644 --- a/src/app/text_copy.rs +++ b/src/app/text_copy.rs @@ -239,13 +239,13 @@ impl App { let mut text = String::new(); let mut ranges = Vec::new(); - for idx in start..=end { + for (idx, line) in self.lines.iter().enumerate().take(end + 1).skip(start) { let clusters = match cell { - Some(cell) => match table_cell_clusters(line_clusters(&self.lines[idx]), cell) { + Some(cell) => match table_cell_clusters(line_clusters(line), cell) { Some(clusters) => clusters, None => continue, }, - None => line_clusters(&self.lines[idx]), + None => line_clusters(line), }; let Some(first) = clusters.iter().position(|c| !is_strippable(c)) else { continue; diff --git a/src/cli.rs b/src/cli.rs index 84efd26..88cef53 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -55,11 +55,7 @@ pub(crate) struct CliOptions { } pub(crate) fn is_diff_spec(value: &str) -> bool { - if value.is_empty() || value.starts_with('-') { - return false; - } - - true + !(value.is_empty() || value.starts_with('-')) } pub(crate) fn parse_diff_spec(value: &str) -> Result { diff --git a/src/tests/render.rs b/src/tests/render.rs index e0087d7..836cb78 100644 --- a/src/tests/render.rs +++ b/src/tests/render.rs @@ -303,9 +303,9 @@ fn trailing_blank_context_lines_are_trimmed() { "Add row must be emitted" ); - for i in (header_idx + 3)..built.lines.len() { + for line in &built.lines[header_idx + 3..] { assert_ne!( - line_text(&built.lines[i]), + line_text(line), "│ ", "no trailing blank context body rows must survive the trim" ); @@ -331,9 +331,9 @@ fn both_leading_and_trailing_blanks_trimmed() { "content Add row must be emitted" ); - for i in (header_idx + 3)..built.lines.len() { + for line in &built.lines[header_idx + 3..] { assert_ne!( - line_text(&built.lines[i]), + line_text(line), "│ ", "no blank context body rows must survive when both trims apply" );