aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/layout_2020/flow/construct.rs5
-rw-r--r--components/layout_2020/flow/inline.rs6
-rw-r--r--components/layout_2020/lib.rs9
3 files changed, 5 insertions, 15 deletions
diff --git a/components/layout_2020/flow/construct.rs b/components/layout_2020/flow/construct.rs
index 52724eb121f..57d7bf9dd31 100644
--- a/components/layout_2020/flow/construct.rs
+++ b/components/layout_2020/flow/construct.rs
@@ -10,7 +10,6 @@ use crate::flow::{BlockContainer, BlockFormattingContext, BlockLevelBox};
use crate::formatting_contexts::IndependentFormattingContext;
use crate::positioned::AbsolutelyPositionedBox;
use crate::style_ext::{DisplayGeneratingBox, DisplayInside, DisplayOutside};
-use crate::take;
use rayon::iter::{IntoParallelIterator, ParallelIterator};
use rayon_croissant::ParallelIteratorExt;
use servo_arc::Arc;
@@ -381,7 +380,7 @@ where
// The fragmented boxes before the block level element
// are obviously not the last fragment.
last_fragment: false,
- children: take(&mut ongoing.children),
+ children: std::mem::take(&mut ongoing.children),
};
ongoing.first_fragment = false;
fragmented
@@ -516,7 +515,7 @@ where
let box_ = IntermediateBlockLevelBox::SameFormattingContextBlock {
style: anonymous_style.clone(),
- contents: IntermediateBlockContainer::InlineFormattingContext(take(
+ contents: IntermediateBlockContainer::InlineFormattingContext(std::mem::take(
&mut self.ongoing_inline_formatting_context,
)),
};
diff --git a/components/layout_2020/flow/inline.rs b/components/layout_2020/flow/inline.rs
index 8ff68f582f5..f6e0d003e03 100644
--- a/components/layout_2020/flow/inline.rs
+++ b/components/layout_2020/flow/inline.rs
@@ -12,7 +12,7 @@ use crate::geom::flow_relative::{Rect, Sides, Vec2};
use crate::positioned::{AbsolutelyPositionedBox, AbsolutelyPositionedFragment};
use crate::replaced::ReplacedContent;
use crate::style_ext::{ComputedValuesExt, Display, DisplayGeneratingBox, DisplayOutside};
-use crate::{relative_adjustement, take, ContainingBlock};
+use crate::{relative_adjustement, ContainingBlock};
use servo_arc::Arc;
use style::properties::ComputedValues;
use style::values::computed::Length;
@@ -185,7 +185,7 @@ impl LinesBoxes {
};
self.next_line_block_position += size.block;
self.boxes.push(Fragment::Anonymous(AnonymousFragment {
- children: take(&mut top_nesting_level.fragments_so_far),
+ children: std::mem::take(&mut top_nesting_level.fragments_so_far),
rect: Rect { start_corner, size },
mode: containing_block.mode,
}))
@@ -250,7 +250,7 @@ impl<'box_tree> PartialInlineBoxFragment<'box_tree> {
) {
let mut fragment = BoxFragment {
style: self.style.clone(),
- children: take(&mut nesting_level.fragments_so_far),
+ children: std::mem::take(&mut nesting_level.fragments_so_far),
content_rect: Rect {
size: Vec2 {
inline: *inline_position - self.start_corner.inline,
diff --git a/components/layout_2020/lib.rs b/components/layout_2020/lib.rs
index 06db3b65acb..f1b3c308be2 100644
--- a/components/layout_2020/lib.rs
+++ b/components/layout_2020/lib.rs
@@ -81,12 +81,3 @@ fn relative_adjustement(
block: adjust(box_offsets.block_start, box_offsets.block_end),
}
}
-
-// FIXME: use std::mem::take when it’s stable.
-// https://github.com/rust-lang/rust/issues/61129
-fn take<T>(x: &mut T) -> T
-where
- T: Default,
-{
- std::mem::replace(x, Default::default())
-}