Update rustfmt to the 2024 style edition (#35764)

* Use 2024 style edition

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Reformat all code

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:
Simon Wülker 2025-03-03 12:26:53 +01:00 committed by GitHub
parent 6300e820b4
commit 3d320fa96a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
603 changed files with 1739 additions and 1648 deletions

View file

@ -793,10 +793,11 @@ impl BlockFlow {
viewport_size: &Size2D<Au>,
descendant: OpaqueFlow,
) -> LogicalSize<Au> {
debug_assert!(self
.base
.flags
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED));
debug_assert!(
self.base
.flags
.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
);
if self.is_fixed() || self.is_root() {
// Initial containing block is the CB for the root
LogicalSize::from_physical(self.base.writing_mode, *viewport_size)

View file

@ -14,8 +14,8 @@
use std::collections::LinkedList;
use std::marker::PhantomData;
use std::mem;
use std::sync::atomic::Ordering;
use std::sync::Arc;
use std::sync::atomic::Ordering;
use html5ever::{local_name, namespace_url, ns};
use log::debug;
@ -24,6 +24,7 @@ use script_layout_interface::wrapper_traits::{
};
use script_layout_interface::{LayoutElementType, LayoutNodeType};
use servo_url::ServoUrl;
use style::LocalName;
use style::computed_values::caption_side::T as CaptionSide;
use style::computed_values::display::T as Display;
use style::computed_values::empty_cells::T as EmptyCells;
@ -38,7 +39,6 @@ use style::selector_parser::{PseudoElement, RestyleDamage};
use style::servo::restyle_damage::ServoRestyleDamage;
use style::values::computed::Image;
use style::values::generics::counters::ContentItem;
use style::LocalName;
use crate::block::BlockFlow;
use crate::context::LayoutContext;
@ -71,7 +71,7 @@ use crate::table_wrapper::TableWrapperFlow;
use crate::text::TextRunScanner;
use crate::traversal::PostorderNodeMutTraversal;
use crate::wrapper::{TextContent, ThreadSafeLayoutNodeHelpers};
use crate::{parallel, ServoArc};
use crate::{ServoArc, parallel};
/// The results of flow construction for a DOM node.
#[derive(Clone, Default)]

View file

@ -11,8 +11,8 @@ use style::values::computed::{
BorderCornerRadius, BorderImageSideWidth, BorderImageWidth, NonNegativeLengthOrNumber,
NumberOrPercentage,
};
use style::values::generics::rect::Rect as StyleRect;
use style::values::generics::NonNegative;
use style::values::generics::rect::Rect as StyleRect;
use webrender_api::units::{LayoutSideOffsets, LayoutSize};
use webrender_api::{BorderRadius, BorderSide, BorderStyle, ColorF, NormalBorder};

View file

@ -12,13 +12,13 @@ use std::default::Default;
use std::sync::Arc;
use std::{f32, mem};
use app_units::{Au, AU_PER_PX};
use app_units::{AU_PER_PX, Au};
use base::id::PipelineId;
use bitflags::bitflags;
use canvas_traits::canvas::{CanvasMsg, FromLayoutMsg};
use embedder_traits::Cursor;
use euclid::default::{Point2D, Rect, SideOffsets2D as UntypedSideOffsets2D, Size2D};
use euclid::{rect, Scale, SideOffsets2D};
use euclid::{Scale, SideOffsets2D, rect};
use fnv::FnvHashMap;
use fonts::ByteIndex;
use ipc_channel::ipc;
@ -26,7 +26,7 @@ use log::{debug, warn};
use net_traits::image_cache::UsePlaceholder;
use range::Range;
use script_layout_interface::{
combine_id_with_fragment_type, FragmentType, IFrameSize, IFrameSizes,
FragmentType, IFrameSize, IFrameSizes, combine_id_with_fragment_type,
};
use servo_geometry::{self, MaxRect};
use style::color::AbsoluteColor;
@ -36,7 +36,7 @@ use style::computed_values::pointer_events::T as PointerEvents;
use style::computed_values::position::T as StylePosition;
use style::computed_values::visibility::T as Visibility;
use style::logical_geometry::{LogicalMargin, LogicalPoint, LogicalRect};
use style::properties::{style_structs, ComputedValues};
use style::properties::{ComputedValues, style_structs};
use style::servo::restyle_damage::ServoRestyleDamage;
use style::values::computed::effects::SimpleShadow;
use style::values::computed::image::Image;
@ -64,7 +64,7 @@ use crate::display_list::items::{
PushTextShadowDisplayItem, StackingContext, StackingContextType, StickyFrameData,
TextOrientation, WebRenderImageInfo,
};
use crate::display_list::{border, gradient, FilterToLayout, ToLayout};
use crate::display_list::{FilterToLayout, ToLayout, border, gradient};
use crate::flow::{BaseFlow, Flow, FlowFlags};
use crate::flow_ref::FlowRef;
use crate::fragment::{

View file

@ -7,8 +7,8 @@
// This might be achieved by sharing types between WR and Servo display lists, or
// completely converting layout to directly generate WebRender display lists, for example.
use base::id::PipelineId;
use base::WebRenderEpochToU16;
use base::id::PipelineId;
use log::trace;
use webrender_api::units::{LayoutPoint, LayoutSize, LayoutVector2D};
use webrender_api::{

View file

@ -847,14 +847,7 @@ impl FlexFlow {
}
let self_align = {
let self_align = block
.fragment
.style()
.get_position()
.align_self
.0
.0
.value();
let self_align = block.fragment.style().get_position().align_self.0.0.value();
match self_align {
AlignFlags::AUTO | AlignFlags::NORMAL => align_items,

View file

@ -27,17 +27,17 @@
use std::fmt;
use std::slice::IterMut;
use std::sync::atomic::Ordering;
use std::sync::Arc;
use std::sync::atomic::Ordering;
use app_units::Au;
use base::print_tree::PrintTree;
use bitflags::bitflags;
use euclid::default::{Point2D, Rect, Size2D, Vector2D};
use log::debug;
use serde::ser::{SerializeStruct, Serializer};
use serde::Serialize;
use servo_geometry::{au_rect_to_f32_rect, f32_rect_to_au_rect, MaxRect};
use serde::ser::{SerializeStruct, Serializer};
use servo_geometry::{MaxRect, au_rect_to_f32_rect, f32_rect_to_au_rect};
use style::computed_values::overflow_x::T as StyleOverflow;
use style::computed_values::position::T as Position;
use style::computed_values::text_align::T as TextAlign;

View file

@ -2,12 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use std::collections::{linked_list, LinkedList};
use std::collections::{LinkedList, linked_list};
use std::ops::Deref;
use std::sync::Arc;
use serde::ser::{Serialize, SerializeSeq, Serializer};
use serde_json::{to_value, Map, Value};
use serde_json::{Map, Value, to_value};
use crate::flow::{Flow, FlowClass};
use crate::flow_ref::FlowRef;

View file

@ -5,7 +5,7 @@
//! The `Fragment` type, which represents the leaves of the layout tree.
use std::borrow::ToOwned;
use std::cmp::{max, min, Ordering};
use std::cmp::{Ordering, max, min};
use std::collections::LinkedList;
use std::sync::{Arc, Mutex};
use std::{f32, fmt};
@ -57,7 +57,7 @@ use webrender_api::units::LayoutTransform;
use webrender_api::{self, ImageKey};
use crate::context::LayoutContext;
use crate::display_list::items::{ClipScrollNodeIndex, OpaqueNode, BLUR_INFLATION_FACTOR};
use crate::display_list::items::{BLUR_INFLATION_FACTOR, ClipScrollNodeIndex, OpaqueNode};
use crate::display_list::{StackingContextId, ToLayout};
use crate::floats::ClearType;
use crate::flow::{GetBaseFlow, ImmutableFlowUtils};
@ -67,12 +67,12 @@ use crate::inline::{
LineMetrics,
};
use crate::model::{
self, style_length, IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto, SizeConstraint,
self, IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto, SizeConstraint, style_length,
};
use crate::text::TextRunScanner;
use crate::text_run::{TextRun, TextRunSlice};
use crate::wrapper::ThreadSafeLayoutNodeHelpers;
use crate::{text, ServoArc};
use crate::{ServoArc, text};
// From gfxFontConstants.h in Firefox.
static FONT_SUBSCRIPT_OFFSET_RATIO: f32 = 0.20;
@ -1649,7 +1649,7 @@ impl Fragment {
},
SpecificFragmentInfo::TruncatedFragment(_) => {
return IntrinsicISizesContribution::new()
return IntrinsicISizesContribution::new();
},
SpecificFragmentInfo::UnscannedText(..) => {

View file

@ -13,7 +13,7 @@ use bitflags::bitflags;
use euclid::default::{Point2D, Rect, Size2D};
use fonts::{FontContext, FontMetrics};
use log::debug;
use range::{int_range_index, Range, RangeIndex};
use range::{Range, RangeIndex, int_range_index};
use script_layout_interface::wrapper_traits::PseudoElementType;
use serde::Serialize;
use servo_geometry::MaxRect;
@ -50,7 +50,7 @@ use crate::fragment::{
};
use crate::model::IntrinsicISizesContribution;
use crate::traversal::PreorderFlowTraversal;
use crate::{text, ServoArc};
use crate::{ServoArc, text};
/// `Line`s are represented as offsets into the child list, rather than
/// as an object that "owns" fragments. Choosing a different set of line

View file

@ -19,13 +19,13 @@ use style::values::computed::length::{
};
use style::values::generics::column::ColumnCount;
use crate::ServoArc;
use crate::block::BlockFlow;
use crate::context::LayoutContext;
use crate::display_list::{DisplayListBuildState, StackingContextCollectionState};
use crate::floats::FloatKind;
use crate::flow::{Flow, FlowClass, FragmentationContext, GetBaseFlow, OpaqueFlow};
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
use crate::ServoArc;
#[allow(unsafe_code)]
unsafe impl crate::flow::HasBaseFlow for MulticolFlow {}

View file

@ -23,8 +23,8 @@ use style::dom::TElement;
use style::logical_geometry::{BlockFlowDirection, InlineBaseDirection, WritingMode};
use style::properties::style_structs::{self, Font};
use style::properties::{
parse_one_declaration_into, ComputedValues, Importance, LonghandId, PropertyDeclarationBlock,
PropertyDeclarationId, PropertyId, ShorthandId, SourcePropertyDeclaration,
ComputedValues, Importance, LonghandId, PropertyDeclarationBlock, PropertyDeclarationId,
PropertyId, ShorthandId, SourcePropertyDeclaration, parse_one_declaration_into,
};
use style::selector_parser::PseudoElement;
use style::shared_lock::SharedRwLock;
@ -32,8 +32,8 @@ use style::stylesheets::{CssRuleType, Origin, UrlExtraData};
use style_traits::{ParsingMode, ToCss};
use crate::construct::ConstructionResult;
use crate::display_list::items::OpaqueNode;
use crate::display_list::IndexableText;
use crate::display_list::items::OpaqueNode;
use crate::flow::{Flow, GetBaseFlow};
use crate::fragment::{Fragment, FragmentBorderBoxIterator, FragmentFlags, SpecificFragmentInfo};
use crate::inline::InlineFragmentNodeFlags;

View file

@ -16,8 +16,8 @@ use style::context::SharedStyleContext;
use style::logical_geometry::LogicalSize;
use style::properties::ComputedValues;
use style::servo::restyle_damage::ServoRestyleDamage;
use style::values::computed::Size;
use style::values::CSSFloat;
use style::values::computed::Size;
use crate::block::{
BlockFlow, CandidateBSizeIterator, ISizeAndMarginsComputer, ISizeConstraintInput,

View file

@ -24,8 +24,8 @@ use style::computed_values::{position, table_layout};
use style::context::SharedStyleContext;
use style::logical_geometry::{LogicalRect, LogicalSize};
use style::properties::ComputedValues;
use style::values::computed::Size;
use style::values::CSSFloat;
use style::values::computed::Size;
use crate::block::{
AbsoluteNonReplaced, BlockFlow, FloatNonReplaced, ISizeAndMarginsComputer,

View file

@ -11,8 +11,8 @@ use std::sync::Arc;
use app_units::Au;
use base::text::is_bidi_control;
use fonts::{
self, ByteIndex, FontContext, FontIdentifier, FontMetrics, FontRef, RunMetrics, ShapingFlags,
ShapingOptions, LAST_RESORT_GLYPH_ADVANCE,
self, ByteIndex, FontContext, FontIdentifier, FontMetrics, FontRef, LAST_RESORT_GLYPH_ADVANCE,
RunMetrics, ShapingFlags, ShapingOptions,
};
use log::{debug, warn};
use range::Range;
@ -20,8 +20,8 @@ use style::computed_values::text_rendering::T as TextRendering;
use style::computed_values::white_space_collapse::T as WhiteSpaceCollapse;
use style::computed_values::word_break::T as WordBreak;
use style::logical_geometry::{LogicalSize, WritingMode};
use style::properties::style_structs::Font as FontStyleStruct;
use style::properties::ComputedValues;
use style::properties::style_structs::Font as FontStyleStruct;
use style::values::generics::font::LineHeight;
use style::values::specified::text::{TextTransform, TextTransformCase};
use unicode_bidi as bidi;

View file

@ -12,14 +12,14 @@ use style::data::ElementData;
use style::dom::{NodeInfo, TElement, TNode};
use style::selector_parser::RestyleDamage;
use style::servo::restyle_damage::ServoRestyleDamage;
use style::traversal::{recalc_style_at, DomTraversal, PerLevelTraversalData};
use style::traversal::{DomTraversal, PerLevelTraversalData, recalc_style_at};
use crate::LayoutData;
use crate::construct::FlowConstructor;
use crate::context::LayoutContext;
use crate::display_list::DisplayListBuildState;
use crate::flow::{Flow, FlowFlags, GetBaseFlow, ImmutableFlowUtils};
use crate::wrapper::ThreadSafeLayoutNodeHelpers;
use crate::LayoutData;
pub struct RecalcStyleAndConstructFlows<'a> {
context: LayoutContext<'a>,