diff options
| author | diannasoreil <mokou@fastmail.com> | 2021-12-24 13:27:52 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-24 13:27:52 +0100 |
| commit | 6516a894858c1651d6a2f18d5396f305912c79fc (patch) | |
| tree | c7c8dccb937cfc48eb4dd70274c1a0fd286d2868 | |
| parent | f7719a4a9ce23386710c76748de406ecdf7eda43 (diff) | |
| parent | 9b27e8d993ca20232fe38a412750c3f845a83b65 (diff) | |
Merge pull request #894 from nekonako/main
chore : replace filter_map() with find_map()
| -rw-r--r-- | src/exercise.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/exercise.rs b/src/exercise.rs index ec694df..e4a4145 100644 --- a/src/exercise.rs +++ b/src/exercise.rs @@ -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; |
