Skip to content

Commit b8bf875

Browse files
authored
Merge pull request #1396 from prehistoric-penguin/patch-1
Simplify the call of filter_map
2 parents a04737e + 9a81505 commit b8bf875

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/error/iter_result.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ fn main() {
2424
let strings = vec!["tofu", "93", "18"];
2525
let numbers: Vec<_> = strings
2626
.into_iter()
27-
.map(|s| s.parse::<i32>())
28-
.filter_map(Result::ok)
27+
.filter_map(|s| s.parse::<i32>().ok())
2928
.collect();
3029
println!("Results: {:?}", numbers);
3130
}

0 commit comments

Comments
 (0)