Skip to content
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

Minor rewrite of std::io::empty doc example. #34517

Merged
merged 1 commit into from
Jun 28, 2016
Merged

Conversation

frewsxcv
Copy link
Member

No description provided.

@@ -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));
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member Author

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.

@frewsxcv frewsxcv force-pushed the empty branch 2 times, most recently from 07de812 to 69c091e Compare June 28, 2016 02:28
Remove unnecessary hidden `foo` function.
Demonstrate this emptiness of the resulting string.
Combine imports.
@frewsxcv frewsxcv changed the title Demonstrate effects of using std::io::Empty. Minor rewrite of std::io::empty doc example. Jun 28, 2016
@frewsxcv
Copy link
Member Author

r? @GuillaumeGomez

@GuillaumeGomez
Copy link
Member

Thanks!

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Jun 28, 2016

📌 Commit a350ca6 has been approved by GuillaumeGomez

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jun 28, 2016
Minor rewrite of `std::io::empty` doc example.

None
bors added a commit that referenced this pull request Jun 28, 2016
@bors bors merged commit a350ca6 into rust-lang:master Jun 28, 2016
@frewsxcv frewsxcv deleted the empty branch October 2, 2016 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants