mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-31 07:38:24 +00:00
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:
2 files changed
+4
-5
No files matched your search
@@ -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();
|
||||
|
||||
@@ -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) };
|
||||
|
||||
Reference in new issue
Block a user