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 <noreply@codebuff.com>
This commit is contained in:
Dylan M. Taylor committed 2026-10-26 09:19:43 -04:00
1 parent bbe793c467
commit eb242b59e4
2 files changed
+4 -5

No files matched your search

+3 -4
View File
@@ -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();
+1 -1
View File
@@ -725,7 +725,7 @@ impl<'a> Para<'a> {
/// The byte ranges of the lines, for the wrap width.
fn break_ranges(&self) -> Vec<Range<usize>> {
if self.width.is_none() {
return vec![0..self.text.len()];
return std::iter::once(0..self.text.len()).collect();
}
let opps: Vec<usize> = 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) };