Skip to content

Commit

Permalink
Merge pull request #1890 from lgarron/patch-1
Browse files Browse the repository at this point in the history
`read_lines`: Use `.map_while(Result::ok)` instead of `.flatten()`.
  • Loading branch information
marioidival authored Oct 26, 2024
2 parents 8bede1b + 04fb7f3 commit 69c0e9b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/std_misc/file/read_lines.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fn main() {
// File hosts.txt must exist in the current path
if let Ok(lines) = read_lines("./hosts.txt") {
// Consumes the iterator, returns an (Optional) String
for line in lines.flatten() {
for line in lines.map_while(Result::ok) {
println!("{}", line);
}
}
Expand Down

0 comments on commit 69c0e9b

Please sign in to comment.