Merge pull request #894 from nekonako/main

chore : replace filter_map() with find_map()
This commit is contained in:
diannasoreil 2021-12-24 13:27:52 +01:00 committed by GitHub
commit 6516a89485
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -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;