Isolate loop in a closure
This required only as intermediate step to show, that nothing is changed in the logic
(Review this commit with whitespace ignored option)
@@ -1134,7 +1134,7 @@ impl<'b, 'i, R: BufRead + 'i> BufferedInput<'b, 'i, &'b mut Vec<u8>> for R {
let mut state = State::Elem;
let mut read = 0;
let mut done = false;
- let end_byte = b'>';
+
let start = buf.len();
while !done {
let used = {
@@ -1154,6 +1154,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);
let used: usize;
loop {
@@ -1186,6 +1187,8 @@ impl<'b, 'i, R: BufRead + 'i> BufferedInput<'b, 'i, &'b mut Vec<u8>> for R {
}
used
};
+ find(b'>')
+ };
self.consume(used);
read += used;
}
