-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix example for BufferedReader #18374
Conversation
/// use std::io::{BufferedWriter, File}; | ||
/// | ||
/// let file = File::open(&Path::new("message.txt")); | ||
/// let file = File::create(&Path::new("message.txt")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a .unwrap()
here too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it need it? This example works as-is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works because we have a sketchy (IMO) impl<E> Stream for Result<Stream, E>
@sfackler done |
/// let file = File::open(&Path::new("message.txt")); | ||
/// let mut writer = BufferedWriter::new(file); | ||
/// let file = File::create(&Path::new("message.txt")); | ||
/// let mut writer = BufferedWriter::new(file).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, sorry, I was looking for this to end up on the call to File::create
, not BufferedWriter::new
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops! duh.
updated! |
Fixes #18197