Skip to content

Commit

Permalink
Merge pull request #894 from nekonako/main
Browse files Browse the repository at this point in the history
chore : replace filter_map() with find_map()
  • Loading branch information
shadows-withal authored Dec 24, 2021
2 parents f7719a4 + 9b27e8d commit 6516a89
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/exercise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6516a89

Please sign in to comment.