rust/tests/target/chains-no-overlow-2.rs
Kamal Marhubi 2b991bc260 tests: Use Result::expect() throughout
`Result::expect()` was added in Rust 1.4. Using it tidies up the code,
and also helps by printing error details, eg, printing syntax error
details if a regex fails to compile. It adds a colon followed by the
`Debug` output from any error, making the periods in messages
unnecessary.
2016-01-31 13:10:09 -05:00

17 lines
550 B
Rust

// rustfmt-chains_overflow_last: false
fn main() {
reader.lines()
.map(|line| line.expect("Failed getting line"))
.take_while(|line| line_regex.is_match(&line))
.filter_map(|line| {
regex.captures_iter(&line)
.next()
.map(|capture| {
(capture.at(1).expect("Couldn\'t unwrap capture").to_owned(),
capture.at(2).expect("Couldn\'t unwrap capture").to_owned())
})
})
.collect();
}