mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Migrate to the 2024 edition (#35755)
* Migrate to 2024 edition Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Allow unsafe_op_in_unsafe_fn lint This lint warns by default in the 2024 edition, but is *way* too noisy for servo. We might enable it in the future, but not now. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Compile using the 2024 edition Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
parent
eb2ca42824
commit
bb0d08432e
66 changed files with 317 additions and 293 deletions
|
@ -33,10 +33,10 @@ pub(super) fn build(
|
|||
) -> WebRenderGradient {
|
||||
match gradient {
|
||||
Gradient::Linear {
|
||||
ref items,
|
||||
ref direction,
|
||||
ref color_interpolation_method,
|
||||
ref flags,
|
||||
items,
|
||||
direction,
|
||||
color_interpolation_method,
|
||||
flags,
|
||||
compat_mode: _,
|
||||
} => build_linear(
|
||||
style,
|
||||
|
@ -48,11 +48,11 @@ pub(super) fn build(
|
|||
builder,
|
||||
),
|
||||
Gradient::Radial {
|
||||
ref shape,
|
||||
ref position,
|
||||
ref color_interpolation_method,
|
||||
ref items,
|
||||
ref flags,
|
||||
shape,
|
||||
position,
|
||||
color_interpolation_method,
|
||||
items,
|
||||
flags,
|
||||
compat_mode: _,
|
||||
} => build_radial(
|
||||
style,
|
||||
|
|
|
@ -780,7 +780,7 @@ impl<'a> BuilderForBoxFragment<'a> {
|
|||
for (index, image) in b.background_image.0.iter().enumerate().rev() {
|
||||
match image {
|
||||
Image::None => {},
|
||||
Image::Gradient(ref gradient) => {
|
||||
Image::Gradient(gradient) => {
|
||||
let intrinsic = NaturalSizes::empty();
|
||||
let Some(layer) =
|
||||
&background::layout_layer(self, painter, builder, index, intrinsic)
|
||||
|
@ -816,7 +816,7 @@ impl<'a> BuilderForBoxFragment<'a> {
|
|||
},
|
||||
}
|
||||
},
|
||||
Image::Url(ref image_url) => {
|
||||
Image::Url(image_url) => {
|
||||
// FIXME: images won’t always have in intrinsic width or
|
||||
// height when support for SVG is added, or a WebRender
|
||||
// `ImageKey`, for that matter.
|
||||
|
|
|
@ -417,7 +417,7 @@ where
|
|||
Node: NodeExt<'dom>,
|
||||
{
|
||||
match &pseudo_element_style.get_counters().content {
|
||||
Content::Items(ref items) => {
|
||||
Content::Items(items) => {
|
||||
let mut vec = vec![];
|
||||
for item in items.items.iter() {
|
||||
match item {
|
||||
|
|
|
@ -740,7 +740,7 @@ impl LineItem {
|
|||
match self {
|
||||
LineItem::InlineStartBoxPaddingBorderMargin(_) => true,
|
||||
LineItem::InlineEndBoxPaddingBorderMargin(_) => true,
|
||||
LineItem::TextRun(_, ref mut item) => item.trim_whitespace_at_end(whitespace_trimmed),
|
||||
LineItem::TextRun(_, item) => item.trim_whitespace_at_end(whitespace_trimmed),
|
||||
LineItem::Atomic(..) => false,
|
||||
LineItem::AbsolutelyPositioned(..) => true,
|
||||
LineItem::Float(..) => true,
|
||||
|
@ -751,7 +751,7 @@ impl LineItem {
|
|||
match self {
|
||||
LineItem::InlineStartBoxPaddingBorderMargin(_) => true,
|
||||
LineItem::InlineEndBoxPaddingBorderMargin(_) => true,
|
||||
LineItem::TextRun(_, ref mut item) => item.trim_whitespace_at_start(whitespace_trimmed),
|
||||
LineItem::TextRun(_, item) => item.trim_whitespace_at_start(whitespace_trimmed),
|
||||
LineItem::Atomic(..) => false,
|
||||
LineItem::AbsolutelyPositioned(..) => true,
|
||||
LineItem::Float(..) => true,
|
||||
|
|
|
@ -1534,7 +1534,7 @@ impl InlineFormattingContext {
|
|||
let mut new_linebreaker = LineBreaker::new(text_content.as_str());
|
||||
for item in builder.inline_items.iter() {
|
||||
match &mut *item.borrow_mut() {
|
||||
InlineItem::TextRun(ref mut text_run) => {
|
||||
InlineItem::TextRun(text_run) => {
|
||||
text_run.borrow_mut().segment_and_shape(
|
||||
&text_content,
|
||||
&layout_context.font_context,
|
||||
|
@ -1683,7 +1683,7 @@ impl InlineFormattingContext {
|
|||
},
|
||||
));
|
||||
},
|
||||
InlineItem::OutOfFlowFloatBox(ref float_box) => {
|
||||
InlineItem::OutOfFlowFloatBox(float_box) => {
|
||||
float_box.layout_into_line_items(&mut layout);
|
||||
},
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ impl BlockLevelBox {
|
|||
BlockLevelBox::OutOfFlowAbsolutelyPositionedBox(_) |
|
||||
BlockLevelBox::OutOfFlowFloatBox(_) => return true,
|
||||
BlockLevelBox::OutsideMarker(_) => return false,
|
||||
BlockLevelBox::Independent(ref context) => {
|
||||
BlockLevelBox::Independent(context) => {
|
||||
// FIXME: If the element doesn't fit next to floats, it will get clearance.
|
||||
// In that case this should be returning false.
|
||||
context.layout_style()
|
||||
|
@ -135,7 +135,7 @@ impl BlockLevelBox {
|
|||
collected_margin.adjoin_assign(&CollapsedMargin::new(margin.block_start));
|
||||
|
||||
let child_boxes = match self {
|
||||
BlockLevelBox::SameFormattingContextBlock { ref contents, .. } => match contents {
|
||||
BlockLevelBox::SameFormattingContextBlock { contents, .. } => match contents {
|
||||
BlockContainer::BlockLevelBoxes(boxes) => boxes,
|
||||
BlockContainer::InlineFormattingContext(_) => return false,
|
||||
},
|
||||
|
@ -427,7 +427,7 @@ fn compute_inline_content_sizes_for_block_level_boxes(
|
|||
match &*box_.borrow() {
|
||||
BlockLevelBox::OutOfFlowAbsolutelyPositionedBox(_) |
|
||||
BlockLevelBox::OutsideMarker { .. } => None,
|
||||
BlockLevelBox::OutOfFlowFloatBox(ref float_box) => {
|
||||
BlockLevelBox::OutOfFlowFloatBox(float_box) => {
|
||||
let inline_content_sizes_result = float_box.contents.outer_inline_content_sizes(
|
||||
layout_context,
|
||||
containing_block,
|
||||
|
@ -465,7 +465,7 @@ fn compute_inline_content_sizes_for_block_level_boxes(
|
|||
// Instead, we treat it like an independent block with 'clear: both'.
|
||||
Some((inline_content_sizes_result, None, Clear::Both))
|
||||
},
|
||||
BlockLevelBox::Independent(ref independent) => {
|
||||
BlockLevelBox::Independent(independent) => {
|
||||
let inline_content_sizes_result = independent.outer_inline_content_sizes(
|
||||
layout_context,
|
||||
containing_block,
|
||||
|
@ -2149,7 +2149,7 @@ fn block_size_is_zero_or_intrinsic(size: &StyleSize, containing_block: &Containi
|
|||
StyleSize::MaxContent |
|
||||
StyleSize::FitContent |
|
||||
StyleSize::Stretch => true,
|
||||
StyleSize::LengthPercentage(ref lp) => {
|
||||
StyleSize::LengthPercentage(lp) => {
|
||||
// TODO: Should this resolve definite percentages? Blink does it, Gecko and WebKit don't.
|
||||
lp.is_definitely_zero() ||
|
||||
(lp.0.has_percentage() && !containing_block.size.block.is_definite())
|
||||
|
|
|
@ -191,7 +191,7 @@ pub fn process_resolved_style_request<'dom>(
|
|||
}
|
||||
|
||||
let (content_rect, margins, padding, specific_layout_info) = match fragment {
|
||||
Fragment::Box(ref box_fragment) | Fragment::Float(ref box_fragment) => {
|
||||
Fragment::Box(box_fragment) | Fragment::Float(box_fragment) => {
|
||||
let box_fragment = box_fragment.borrow();
|
||||
if style.get_box().position != Position::Static {
|
||||
let resolved_insets = || {
|
||||
|
|
|
@ -338,7 +338,7 @@ impl ComputedValuesExt for ComputedValues {
|
|||
fn physical_box_offsets(&self) -> PhysicalSides<LengthPercentageOrAuto<'_>> {
|
||||
fn convert(inset: &Inset) -> LengthPercentageOrAuto<'_> {
|
||||
match inset {
|
||||
Inset::LengthPercentage(ref v) => LengthPercentageOrAuto::LengthPercentage(v),
|
||||
Inset::LengthPercentage(v) => LengthPercentageOrAuto::LengthPercentage(v),
|
||||
Inset::Auto => LengthPercentageOrAuto::Auto,
|
||||
Inset::AnchorFunction(_) => unreachable!("anchor() should be disabled"),
|
||||
Inset::AnchorSizeFunction(_) => unreachable!("anchor-size() should be disabled"),
|
||||
|
@ -460,7 +460,7 @@ impl ComputedValuesExt for ComputedValues {
|
|||
fn physical_margin(&self) -> PhysicalSides<LengthPercentageOrAuto<'_>> {
|
||||
fn convert(inset: &Margin) -> LengthPercentageOrAuto<'_> {
|
||||
match inset {
|
||||
Margin::LengthPercentage(ref v) => LengthPercentageOrAuto::LengthPercentage(v),
|
||||
Margin::LengthPercentage(v) => LengthPercentageOrAuto::LengthPercentage(v),
|
||||
Margin::Auto => LengthPercentageOrAuto::Auto,
|
||||
Margin::AnchorSizeFunction(_) => unreachable!("anchor-size() should be disabled"),
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ impl<Node> AnonymousTableContent<'_, Node> {
|
|||
fn is_whitespace_only(&self) -> bool {
|
||||
match self {
|
||||
Self::Element { .. } => false,
|
||||
Self::Text(_, ref text) => text.chars().all(char_is_whitespace),
|
||||
Self::Text(_, text) => text.chars().all(char_is_whitespace),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ impl Table {
|
|||
let slot = self.get_slot(coords);
|
||||
match slot {
|
||||
Some(TableSlot::Cell(cell)) => vec![ResolvedSlotAndLocation { cell, coords }],
|
||||
Some(TableSlot::Spanned(ref offsets)) => offsets
|
||||
Some(TableSlot::Spanned(offsets)) => offsets
|
||||
.iter()
|
||||
.flat_map(|offset| self.resolve_slot_at(coords - *offset))
|
||||
.collect(),
|
||||
|
@ -434,7 +434,7 @@ impl TableBuilder {
|
|||
for row_index in 0..self.table.size.height {
|
||||
let last_row_index_in_group = self.last_row_index_in_row_group_at_row_n(row_index);
|
||||
for cell in self.table.slots[row_index].iter_mut() {
|
||||
if let TableSlot::Cell(ref mut cell) = cell {
|
||||
if let TableSlot::Cell(cell) = cell {
|
||||
if cell.rowspan == 1 {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -1093,7 +1093,7 @@ impl<'a> TableLayout<'a> {
|
|||
.par_iter()
|
||||
.enumerate()
|
||||
.map(|(column_index, slot)| {
|
||||
let TableSlot::Cell(ref cell) = slot else {
|
||||
let TableSlot::Cell(cell) = slot else {
|
||||
return None;
|
||||
};
|
||||
|
||||
|
@ -2303,19 +2303,18 @@ impl<'a> RowFragmentLayout<'a> {
|
|||
relative_adjustement(&self.row.style, containing_block_for_children);
|
||||
}
|
||||
|
||||
let (inline_size, block_size) =
|
||||
if let Some(ref row_group_layout) = row_group_fragment_layout {
|
||||
self.rect.start_corner -= row_group_layout.rect.start_corner;
|
||||
(
|
||||
row_group_layout.rect.size.inline,
|
||||
SizeConstraint::Definite(row_group_layout.rect.size.block),
|
||||
)
|
||||
} else {
|
||||
(
|
||||
containing_block_for_logical_conversion.size.inline,
|
||||
containing_block_for_logical_conversion.size.block,
|
||||
)
|
||||
};
|
||||
let (inline_size, block_size) = if let Some(row_group_layout) = row_group_fragment_layout {
|
||||
self.rect.start_corner -= row_group_layout.rect.start_corner;
|
||||
(
|
||||
row_group_layout.rect.size.inline,
|
||||
SizeConstraint::Definite(row_group_layout.rect.size.block),
|
||||
)
|
||||
} else {
|
||||
(
|
||||
containing_block_for_logical_conversion.size.inline,
|
||||
containing_block_for_logical_conversion.size.block,
|
||||
)
|
||||
};
|
||||
|
||||
let row_group_containing_block = ContainingBlock {
|
||||
size: ContainingBlockSize {
|
||||
|
|
|
@ -52,8 +52,8 @@ fn with_independant_formatting_context<T>(
|
|||
cb: impl FnOnce(&IndependentFormattingContext) -> T,
|
||||
) -> T {
|
||||
match item {
|
||||
TaffyItemBoxInner::InFlowBox(ref mut context) => cb(context),
|
||||
TaffyItemBoxInner::OutOfFlowAbsolutelyPositionedBox(ref abspos_box) => {
|
||||
TaffyItemBoxInner::InFlowBox(context) => cb(context),
|
||||
TaffyItemBoxInner::OutOfFlowAbsolutelyPositionedBox(abspos_box) => {
|
||||
cb(&AtomicRefCell::borrow(abspos_box).context)
|
||||
},
|
||||
}
|
||||
|
|
|
@ -302,7 +302,7 @@ fn test_tree_range_setting() {
|
|||
quickcheck::quickcheck(f);
|
||||
fn check(bands: Vec<FloatBandWrapper>, ranges: Vec<FloatRangeInput>) {
|
||||
let mut tree = FloatBandTree::new();
|
||||
for FloatBandWrapper(ref band) in &bands {
|
||||
for FloatBandWrapper(band) in &bands {
|
||||
tree = tree.insert(*band);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue