From eb242b59e4f794396e02e76d9b95d65fbf93a89a Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Mon, 26 Oct 2026 09:19:43 -0400 Subject: [PATCH] Fix clippy errors that fail the effectcraft gate Use iter::once for the single-range break fallback, and collapse a nested if in the WGSL grammar test helper into a match guard. Behaviour is unchanged. Generated with Codebuff Co-Authored-By: Codebuff --- crates/gpu/src/tests_wgsl_grammar.rs | 7 +++---- crates/text/src/layout.rs | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/gpu/src/tests_wgsl_grammar.rs b/crates/gpu/src/tests_wgsl_grammar.rs index 7153e4010..95fbea071 100644 --- a/crates/gpu/src/tests_wgsl_grammar.rs +++ b/crates/gpu/src/tests_wgsl_grammar.rs @@ -176,11 +176,10 @@ fn violations(src: &str) -> Vec<(usize, String)> { let tok = next_token(&s, &mut i); match tok { Tok::Open => levels.push(vec![]), - Tok::Close => { - if levels.len() > 1 { - levels.pop(); - } + Tok::Close if levels.len() > 1 => { + levels.pop(); } + Tok::Close => {} Tok::Sep => { if let Some(l) = levels.last_mut() { l.clear(); diff --git a/crates/text/src/layout.rs b/crates/text/src/layout.rs index 62b551d6d..1f2e32115 100644 --- a/crates/text/src/layout.rs +++ b/crates/text/src/layout.rs @@ -725,7 +725,7 @@ impl<'a> Para<'a> { /// The byte ranges of the lines, for the wrap width. fn break_ranges(&self) -> Vec> { if self.width.is_none() { - return vec![0..self.text.len()]; + return std::iter::once(0..self.text.len()).collect(); } let opps: Vec = unicode_linebreak::linebreaks(self.text).map(|(p, _)| p).collect(); let mut ranges = if self.para.every_line && opps.len() > 1 && opps.len() <= 1500 { self.optimal_breaks(&opps) } else { self.greedy_breaks(opps) };