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

Return errors when swap_nonatomic fails #8

Merged
merged 2 commits into from
Sep 11, 2018

Conversation

ngotchac
Copy link
Contributor

@ngotchac ngotchac commented Sep 7, 2018

Don't silently fail when non-atomic swap fails

src/lib.rs Outdated
@@ -40,21 +40,23 @@ pub fn swap_nonatomic<A, B>(a: A, b: B) -> io::Result<()> where A: AsRef<Path>,

match fs::rename(b, a) {
Ok(_) => (),
Err(_) => {
Err(e) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we're not using e directly, Err(e) can be matched by error or other variable name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

@debris debris merged commit c9644f4 into debris:master Sep 11, 2018
@debris
Copy link
Owner

debris commented Sep 11, 2018

thanks! published in 0.2.4

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.

5 participants