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

Fix ignored error in example #39

Merged
merged 3 commits into from
Jan 2, 2018
Merged

Fix ignored error in example #39

merged 3 commits into from
Jan 2, 2018

Conversation

rfdonnelly
Copy link
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.
README.md Outdated
dir.close()?;
}
use std::io;
use std::io::Write;
Copy link
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};

Copy link
Contributor

@KodrAus KodrAus left a comment

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
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