Skip to content
This repository was archived by the owner on Aug 20, 2021. It is now read-only.

Fix ignored error in example#39

Merged
KodrAus merged 3 commits into
rust-lang-deprecated:masterfrom
rfdonnelly:fix-ignored-error-in-example
Jan 2, 2018
Merged

Fix ignored error in example#39
KodrAus merged 3 commits into
rust-lang-deprecated:masterfrom
rfdonnelly:fix-ignored-error-in-example

Conversation

@rfdonnelly

Copy link
Copy Markdown
Contributor

This PR makes three changes to the example in the README:

  1. Fixes silently ignored Err result from TempDir::new
  2. Adds use statements necessary to get example to compile
  3. Simplifies the return type by using the io:Result type

Previous to this change, the Err result from TempDir::new was silently
ignored.

Fix by handling the Err result using the '?' operator.
Comment thread README.md Outdated
dir.close()?;
}
use std::io;
use std::io::Write;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could simplify this to use std::io::{self, Write};

@KodrAus KodrAus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rfdonnelly! I've left a really minor comment about one of the use statements but otherwise this looks good to me!

@rfdonnelly

Copy link
Copy Markdown
Contributor Author

@KodrAus I wasn't aware you could use self that way. That's nice! I fixed up the commit as you suggested.

@KodrAus KodrAus merged commit 41377a0 into rust-lang-deprecated:master Jan 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants