Closed
Description
context: I'm doing the newbie Rust thing of writing some program that reads lines of a file. From stackoverflow I find myself at BufReader.lines()
and then BufRead.lines()
docs.
What I'm finding confusing in the docs is that lines()
returns a Result, but the example in the docs blindly unwrap()
s that result, and so does every caller of lines()
I find in demo code. It would be nice if BufRead (or, if it's more appropriate there, then maybe in BufReader's impl) would explain under what circumstances you'd get an error instead of Ok
when reading a file, so I know if unwrap()
is appropriate to use or not.