Skip to content

Commit

Permalink
chore : replace filter_map() with find_map()
Browse files Browse the repository at this point in the history
  • Loading branch information
nekonako committed Dec 24, 2021
1 parent f7719a4 commit 9b27e8d
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 9b27e8d

Please sign in to comment.