mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-29 16:44:18 -05:00
Merge pull request #894 from nekonako/main
chore : replace filter_map() with find_map()
This commit is contained in:
commit
6516a89485
1 changed files with 1 additions and 2 deletions
|
@ -217,8 +217,7 @@ path = "{}.rs""#,
|
||||||
let matched_line_index = source
|
let matched_line_index = source
|
||||||
.lines()
|
.lines()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.filter_map(|(i, line)| if re.is_match(line) { Some(i) } else { None })
|
.find_map(|(i, line)| if re.is_match(line) { Some(i) } else { None })
|
||||||
.next()
|
|
||||||
.expect("This should not happen at all");
|
.expect("This should not happen at all");
|
||||||
|
|
||||||
let min_line = ((matched_line_index as i32) - (CONTEXT as i32)).max(0) as usize;
|
let min_line = ((matched_line_index as i32) - (CONTEXT as i32)).max(0) as usize;
|
||||||
|
|
Loading…
Reference in a new issue