Skip to content

book-store: don't use std::mem::replace unnecessarily#977

Merged
coriolinus merged 1 commit intomasterfrom
book-store-fix-warnings
Oct 9, 2020
Merged

book-store: don't use std::mem::replace unnecessarily#977
coriolinus merged 1 commit intomasterfrom
book-store-fix-warnings

Conversation

@coriolinus
Copy link
Copy Markdown
Member

At some point, std::mem::replace gained the #[must_use] attribute:
if you don't use the previous value, there's no reason not to just
assign to the target directly. This caused a warning to be emitted,
which broke our check that no examples generate warnings.

This PR fixes that.

FWIW, I'm apparently to blame for the original use of mem::replace;
at this remove, I have no idea what I was thinking then.

At some point, std::mem::replace gained the `#[must_use]` attribute:
if you don't use the previous value, there's no reason not to just
assign to the target directly. This caused a warning to be emitted,
which broke our check that no examples generate warnings.

This PR fixes that.

FWIW, I'm apparently to blame for the original use of mem::replace;
at this remove, I have no idea what I was thinking then.
@coriolinus coriolinus merged commit dd5bddd into master Oct 9, 2020
@coriolinus coriolinus deleted the book-store-fix-warnings branch October 9, 2020 12:12
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.

2 participants