[code] iterators all the way

This commit is contained in:
Paul Schulze 2024-03-05 18:53:26 +01:00
parent ae83358d14
commit 1daa5d5304
Signed by: ddidderr
GPG Key ID: 2186CDA2E090A755

View File

@ -45,12 +45,10 @@ where
fn trim_end(line: &[u8]) -> usize { fn trim_end(line: &[u8]) -> usize {
let mut end = line.len(); let mut end = line.len();
for ch in line.iter().rev() { line.iter()
if *ch != b'\r' && *ch != b'\n' && *ch != b'\t' { .rev()
break; .take_while(|ch| ch.is_ascii_whitespace())
} .for_each(|_| end -= 1);
end -= 1;
}
end end
} }