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

Can we get rid of the std::mem::replace warning? #52

Closed
drwilco opened this issue Aug 12, 2020 · 2 comments · Fixed by #53
Closed

Can we get rid of the std::mem::replace warning? #52

drwilco opened this issue Aug 12, 2020 · 2 comments · Fixed by #53

Comments

@drwilco
Copy link
Contributor

drwilco commented Aug 12, 2020

My compiler keeps complaining about:

std::mem::replace(self, HashMap::new());

warning: unused return value of `std::mem::replace` that must be used
   --> src/stores.rs:630:9
    |
630 |         std::mem::replace(self, HashMap::new());
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(unused_must_use)]` on by default
    = note: if you don't need the old value, you can just assign the new value directly

warning: 1 warning emitted

Is there a reason for using std::mem::replace instead of just *self = HashMap::new();?

For convenience, incoming PR

@Stargateur
Copy link
Contributor

None in this case, in my defense it's a new warning or I'm blind.

@drwilco
Copy link
Contributor Author

drwilco commented Aug 17, 2020

It could be new, I'm on 1.45.0. Anyways, PR #53 will get rid of it.

@jaemk jaemk closed this as completed in #53 Sep 8, 2020
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 a pull request may close this issue.

2 participants