aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_2020/table
diff options
context:
space:
mode:
Diffstat (limited to 'components/layout_2020/table')
-rw-r--r--components/layout_2020/table/construct.rs22
-rw-r--r--components/layout_2020/table/layout.rs10
-rw-r--r--components/layout_2020/table/mod.rs8
3 files changed, 18 insertions, 22 deletions
diff --git a/components/layout_2020/table/construct.rs b/components/layout_2020/table/construct.rs
index bd183a2519d..34d0a42f6e7 100644
--- a/components/layout_2020/table/construct.rs
+++ b/components/layout_2020/table/construct.rs
@@ -133,20 +133,16 @@ impl Table {
/// the target and returns a [`ResolvedSlotAndLocation`] for each of them. If there is
/// no slot at the given coordinates or that slot is an empty space, an empty vector
/// is returned.
- pub(super) fn resolve_slot_at<'a>(
- &'a self,
+ pub(super) fn resolve_slot_at(
+ &self,
coords: TableSlotCoordinates,
- ) -> Vec<ResolvedSlotAndLocation<'a>> {
+ ) -> Vec<ResolvedSlotAndLocation<'_>> {
let slot = self.get_slot(coords);
match slot {
- Some(TableSlot::Cell(cell)) => vec![ResolvedSlotAndLocation {
- cell: &cell,
- coords,
- }],
+ Some(TableSlot::Cell(cell)) => vec![ResolvedSlotAndLocation { cell, coords }],
Some(TableSlot::Spanned(ref offsets)) => offsets
.iter()
- .map(|offset| self.resolve_slot_at(coords - *offset))
- .flatten()
+ .flat_map(|offset| self.resolve_slot_at(coords - *offset))
.collect(),
Some(TableSlot::Empty) | None => {
warn!("Tried to resolve an empty or nonexistant slot!");
@@ -170,12 +166,12 @@ impl Table {
let coords_of_slots_that_cover_target: Vec<_> = slots_covering_slot_above
.into_iter()
- .filter(|ref slot| slot.covers_cell_at(target_coords))
+ .filter(|slot| slot.covers_cell_at(target_coords))
.map(|slot| target_coords - slot.coords)
.collect();
if coords_of_slots_that_cover_target.is_empty() {
- return None;
+ None
} else {
Some(TableSlot::Spanned(coords_of_slots_that_cover_target))
}
@@ -245,7 +241,7 @@ impl TableBuilder {
TableSlotCoordinates::new(self.current_x(), self.current_y())
}
- pub fn start_row<'builder>(&'builder mut self) {
+ pub fn start_row(&mut self) {
self.table.slots.push(Vec::new());
self.table.size.height += 1;
self.create_slots_for_cells_above_with_rowspan(true);
@@ -421,7 +417,7 @@ where
return;
}
- let row_content = std::mem::replace(&mut self.current_anonymous_row_content, Vec::new());
+ let row_content = std::mem::take(&mut self.current_anonymous_row_content);
let context = self.context;
let anonymous_style = self
.context
diff --git a/components/layout_2020/table/layout.rs b/components/layout_2020/table/layout.rs
index 1c4fab51f4f..acd49a7ebc6 100644
--- a/components/layout_2020/table/layout.rs
+++ b/components/layout_2020/table/layout.rs
@@ -199,10 +199,10 @@ impl<'a> TableLayout<'a> {
Auto => (min_content_width, min_content_width, max_content_width),
};
- min_content_sizing_guesses.push(min_content_width.into());
- min_content_percentage_sizing_guesses.push(min_content_percentage_sizing_guess.into());
- min_content_specified_sizing_guesses.push(min_content_specified_sizing_guess.into());
- max_content_sizing_guesses.push(max_content_sizing_guess.into());
+ min_content_sizing_guesses.push(min_content_width);
+ min_content_percentage_sizing_guesses.push(min_content_percentage_sizing_guess);
+ min_content_specified_sizing_guesses.push(min_content_specified_sizing_guess);
+ max_content_sizing_guesses.push(max_content_sizing_guess);
}
// > If the assignable table width is less than or equal to the max-content sizing-guess, the
@@ -493,7 +493,7 @@ impl Table {
positioning_context: &mut PositioningContext,
containing_block: &ContainingBlock,
) -> IndependentLayout {
- let mut table_layout = TableLayout::new(&self);
+ let mut table_layout = TableLayout::new(self);
table_layout.compute_measures(layout_context, positioning_context, containing_block);
let (fragments, content_block_size) =
table_layout.layout_into_box_fragments(positioning_context);
diff --git a/components/layout_2020/table/mod.rs b/components/layout_2020/table/mod.rs
index ec874f20b98..d91137ec6af 100644
--- a/components/layout_2020/table/mod.rs
+++ b/components/layout_2020/table/mod.rs
@@ -50,7 +50,7 @@ impl Table {
/// Return the slot at the given coordinates, if it exists in the table, otherwise
/// return None.
- fn get_slot<'a>(&'a self, coords: TableSlotCoordinates) -> Option<&'a TableSlot> {
+ fn get_slot(&self, coords: TableSlotCoordinates) -> Option<&TableSlot> {
self.slots.get(coords.y)?.get(coords.x)
}
@@ -60,8 +60,8 @@ impl Table {
) -> Option<TableSlotCoordinates> {
match self.get_slot(coords) {
Some(&TableSlot::Cell(_)) => Some(coords),
- Some(&TableSlot::Spanned(ref offsets)) => Some(coords - offsets[0]),
- _ => return None,
+ Some(TableSlot::Spanned(offsets)) => Some(coords - offsets[0]),
+ _ => None,
}
}
@@ -73,7 +73,7 @@ impl Table {
let slot = self.get_slot(resolved_coords);
match slot {
- Some(&TableSlot::Cell(ref cell)) => Some(cell),
+ Some(TableSlot::Cell(cell)) => Some(cell),
_ => unreachable!(
"Spanned slot should not point to an empty cell or another spanned slot."
),