-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Minor rewrite of std::io::empty
doc example.
#34517
Conversation
@@ -78,14 +78,15 @@ pub struct Empty { _priv: () } | |||
/// A slightly sad example of not reading anything into a buffer: | |||
/// | |||
/// ``` | |||
/// use std::io; | |||
/// use std::io::Read; | |||
/// use std::io::{self, Read}; | |||
/// | |||
/// # fn foo() -> io::Result<String> { | |||
/// let mut buffer = String::new(); | |||
/// try!(io::empty().read_to_string(&mut buffer)); |
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.
Should all these try!
s be converted to unwraps? That seems to be the modern convention?
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.
Works for me. I'll change them.
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.
Fixed in the latest force push.
07de812
to
69c091e
Compare
Remove unnecessary hidden `foo` function. Demonstrate this emptiness of the resulting string. Combine imports.
std::io::Empty
.std::io::empty
doc example.
Thanks! @bors: r+ rollup |
📌 Commit a350ca6 has been approved by |
Minor rewrite of `std::io::empty` doc example. None
No description provided.