[code] iterators all the way
This commit is contained in:
parent
ae83358d14
commit
1daa5d5304
10
src/main.rs
10
src/main.rs
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user