We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 2734c6c + 7a95f76 commit e314c6cCopy full SHA for e314c6c
src/std_misc/file/read_lines.md
@@ -56,10 +56,8 @@ fn main() {
56
// File hosts.txt must exist in the current path
57
if let Ok(lines) = read_lines("./hosts.txt") {
58
// Consumes the iterator, returns an (Optional) String
59
- for line in lines {
60
- if let Ok(ip) = line {
61
- println!("{}", ip);
62
- }
+ for line in lines.flatten() {
+ println!("{}", line);
63
}
64
65
0 commit comments