Convert loop into for-in
(Review this commit with whitespace ignored option)
@@ -1155,10 +1155,7 @@ impl<'b, 'i, R: BufRead + 'i> BufferedInput<'b, 'i, &'b mut Vec<u8>> for R {
};
let mut find = |end_byte| -> usize {
- let mut memiter = memchr::memchr3_iter(end_byte, b'\'', b'"', available);
- loop {
- match memiter.next() {
- Some(i) => {
+ for i in memchr::memchr3_iter(end_byte, b'\'', b'"', available) {
state = match (state, available[i]) {
(State::Elem, b) if b == end_byte => {
// only allowed to match `end_byte` while we are in state `Elem`
@@ -1176,9 +1173,6 @@ impl<'b, 'i, R: BufRead + 'i> BufferedInput<'b, 'i, &'b mut Vec<u8>> for R {
_ => state,
};
}
- None => break,
- }
- }
buf.extend_from_slice(available);
return available.len();
};
