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

Replaced mem::replace with mem::take for old_min_size #33959

Merged
merged 2 commits into from
Oct 21, 2024

Conversation

chickenleaf
Copy link
Contributor

Files: servo/components/layout_2020/positioned.rs

PR Description:
Issue:
Improved the code in servo/components/layout_2020/positioned.rs by using mem::take instead of mem::replace for setting default values. This makes the code cleaner and more idiomatic.

Changes:
let old_min_size = mem::take(&mut self.computed_min_size);
-This change uses mem::take, which automatically provides the default value of Au, eliminating the need to specify Au::zero() explicitly.

Impact:
The change improves code readability and makes it more idiomatic by using mem::take.


  • There are tests for these changes OR
  • These changes do not require tests because does not alter functionality.

@Loirooriol Loirooriol enabled auto-merge October 21, 2024 18:52
@Loirooriol Loirooriol added this pull request to the merge queue Oct 21, 2024
Merged via the queue into servo:main with commit aeed5ca Oct 21, 2024
14 checks passed
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.

Prefer mem::take over mem::replace with default value
2 participants