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

replace replace with take according to clippy suggestion #1611

Merged
merged 1 commit into from
Jan 25, 2025

Conversation

lovelock
Copy link
Contributor

If this pull request (PR) is associated with coding or code transpilation, please attach the relevant console outputs to the PR and complete the following checklist:

  • I have thoroughly reviewed the code, focusing on its formatting, comments, indentation, and file headers.
  • I have confirmed that the code execution outputs are consistent with those produced by the reference code (Python or Java).
  • The code is designed to be compatible on standard operating systems, including Windows, macOS, and Ubuntu.

@krahets
Copy link
Owner

krahets commented Jan 13, 2025

Hi @rongyi , could you review this PR? Thx!

@rongyi
Copy link
Contributor

rongyi commented Jan 25, 2025

std::mem::take is essentially a specialized version of replace that always uses the default value (Default::default()) as the replacement. It's equivalent to:

std::mem::replace(&mut self.buckets, Vec::new())

so, yes, this change LGTM

Copy link
Contributor

@rongyi rongyi left a comment

Choose a reason for hiding this comment

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

LGTM

@krahets
Copy link
Owner

krahets commented Jan 25, 2025

Thank you for the PR!

@krahets krahets added code Code-related polish Decorative detail or feature labels Jan 25, 2025
@krahets krahets merged commit e36453a into krahets:main Jan 25, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code Code-related polish Decorative detail or feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants