I know why this is broken:
while let Some(Ok(raw)) = lines.next() {
let line = raw.trim();
if line.starts_with("Running unittests") {
test_suite_start(line, &mut output);
} else if line.starts_with("running ") {
num_tests_running(line, &mut output);
} else if line.starts_with("test result: ok. 0 passed") {
test_suite_result_no_tests(line, &mut output);
} else if line.starts_with("test result: ok.") {
test_suite_result_ok(line, &mut output);
} else if line.ends_with("FAILED") {
test_result_failed(line, &mut output);
while let Some(true) = lines.peekable().peek().map(|item| &item.unwrap_or_default().starts_with('@')){
let extra_output = lines.next();
// we need to consume strings until one doesn't start with '@'
do_something(extra_output)
}
} else if line.ends_with(" ... ok") {
continue;
}
I am trying to use lines after it moved. I am not sure the idiomatic way of doing this.