diff --git a/src/main.rs b/src/main.rs index 6c17891..91e7010 100644 --- a/src/main.rs +++ b/src/main.rs @@ -45,12 +45,10 @@ where fn trim_end(line: &[u8]) -> usize { let mut end = line.len(); - for ch in line.iter().rev() { - if *ch != b'\r' && *ch != b'\n' && *ch != b'\t' { - break; - } - end -= 1; - } + line.iter() + .rev() + .take_while(|ch| ch.is_ascii_whitespace()) + .for_each(|_| end -= 1); end }