Replaced mem::replace with mem::take for old_min_size #33959
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Files:
servo/components/layout_2020/positioned.rs
PR Description:
Issue:
Improved the code in
servo/components/layout_2020/positioned.rs
by usingmem::take
instead ofmem::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 ofAu
, eliminating the need to specifyAu::zero()
explicitly.Impact:
The change improves code readability and makes it more idiomatic by using
mem::take
../mach build -d
does not report any errors./mach test-tidy
does not report any errorsmem::take
overmem::replace
with default value #33945