1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2024-11-08 09:09:17 +01:00

chore : replace filter_map() with find_map()

This commit is contained in:
Galih wisnuaji 2021-12-24 13:48:43 +07:00
parent f7719a4a9c
commit 9b27e8d993

@ -217,8 +217,7 @@ path = "{}.rs""#,
let matched_line_index = source
.lines()
.enumerate()
.filter_map(|(i, line)| if re.is_match(line) { Some(i) } else { None })
.next()
.find_map(|(i, line)| if re.is_match(line) { Some(i) } else { None })
.expect("This should not happen at all");
let min_line = ((matched_line_index as i32) - (CONTEXT as i32)).max(0) as usize;