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

@ -6,8 +6,8 @@ use std::collections::HashMap;
use std::fmt;
use std::time::Duration;
use base::id::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId, WebViewId};
use base::Epoch;
use base::id::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId, WebViewId};
use embedder_traits::{
Cursor, InputEvent, MediaSessionActionType, Theme, TraversalDirection, WebDriverCommandMsg,
};

View file

@ -8,8 +8,8 @@ mod constellation_msg;
use std::fmt::{Debug, Error, Formatter};
use base::id::{PipelineId, TopLevelBrowsingContextId};
use base::Epoch;
use base::id::{PipelineId, TopLevelBrowsingContextId};
pub use constellation_msg::ConstellationMsg;
use crossbeam_channel::{Receiver, Sender};
use embedder_traits::{EventLoopWaker, MouseButton, MouseButtonAction};

View file

@ -12,8 +12,8 @@ use euclid::default::Rect as UntypedRect;
use euclid::{Rect, Size2D};
use hyper_serde::Serde;
use ipc_channel::ipc::IpcSender;
use keyboard_types::webdriver::Event as WebDriverInputEvent;
use keyboard_types::KeyboardEvent;
use keyboard_types::webdriver::Event as WebDriverInputEvent;
use pixels::Image;
use serde::{Deserialize, Serialize};
use servo_url::ServoUrl;

View file

@ -7,7 +7,7 @@
use std::sync::Arc;
use malloc_size_of_derive::MallocSizeOf;
use range::{int_range_index, RangeIndex};
use range::{RangeIndex, int_range_index};
use serde::{Deserialize, Serialize};
int_range_index! {

View file

@ -13,8 +13,8 @@ use serde::{Deserialize, Serialize};
use servo_url::{ImmutableOrigin, ServoUrl};
use webrender_traits::CrossProcessCompositorApi;
use crate::request::CorsSettings;
use crate::FetchResponseMsg;
use crate::request::CorsSettings;
// ======================================================================
// Aux structs and enums.

View file

@ -12,14 +12,14 @@ use std::thread;
use base::cross_process_instant::CrossProcessInstant;
use base::id::HistoryStateId;
use cookie::Cookie;
use crossbeam_channel::{unbounded, Receiver, Sender};
use crossbeam_channel::{Receiver, Sender, unbounded};
use headers::{ContentType, HeaderMapExt, ReferrerPolicy as ReferrerPolicyHeader};
use http::{header, Error as HttpError, HeaderMap, HeaderValue, StatusCode};
use http::{Error as HttpError, HeaderMap, HeaderValue, StatusCode, header};
use hyper_serde::Serde;
use hyper_util::client::legacy::Error as HyperError;
use ipc_channel::Error as IpcError;
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER;
use ipc_channel::Error as IpcError;
use malloc_size_of::malloc_size_of_is_0;
use malloc_size_of_derive::MallocSizeOf;
use mime::Mime;

View file

@ -6,7 +6,7 @@ use std::sync::{Arc, Mutex};
use base::id::{PipelineId, WebViewId};
use content_security_policy::{self as csp};
use http::header::{HeaderName, AUTHORIZATION};
use http::header::{AUTHORIZATION, HeaderName};
use http::{HeaderMap, Method};
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use malloc_size_of_derive::MallocSizeOf;

View file

@ -4,8 +4,8 @@
//! The [Response](https://fetch.spec.whatwg.org/#responses) object
//! resulting from a [fetch operation](https://fetch.spec.whatwg.org/#concept-fetch)
use std::sync::atomic::AtomicBool;
use std::sync::Mutex;
use std::sync::atomic::AtomicBool;
use headers::{ContentType, HeaderMapExt};
use http::HeaderMap;

View file

@ -19,12 +19,12 @@ use std::fmt;
use std::sync::Arc;
use background_hang_monitor_api::BackgroundHangMonitorRegister;
use base::Epoch;
use base::cross_process_instant::CrossProcessInstant;
use base::id::{
BlobId, BrowsingContextId, HistoryStateId, MessagePortId, PipelineId, PipelineNamespaceId,
TopLevelBrowsingContextId, WebViewId,
};
use base::Epoch;
use bitflags::bitflags;
#[cfg(feature = "bluetooth")]
use bluetooth_traits::BluetoothRequest;
@ -35,8 +35,8 @@ use embedder_traits::input_events::InputEvent;
use embedder_traits::{MediaSessionActionType, Theme, WebDriverScriptCommand};
use euclid::{Rect, Scale, Size2D, UnknownUnit, Vector2D};
use http::{HeaderMap, Method};
use ipc_channel::ipc::{IpcReceiver, IpcSender};
use ipc_channel::Error as IpcError;
use ipc_channel::ipc::{IpcReceiver, IpcSender};
use libc::c_void;
use log::warn;
use malloc_size_of::malloc_size_of_is_0;
@ -806,7 +806,9 @@ impl StructuredSerializedData {
if self.ports.is_some() {
// Not panicking only because this is called from the constellation.
warn!("Attempt to broadcast structured serialized data including ports(should never happen).");
warn!(
"Attempt to broadcast structured serialized data including ports(should never happen)."
);
}
StructuredSerializedData {

View file

@ -5,27 +5,27 @@
use std::collections::{HashMap, VecDeque};
use std::fmt;
use base::Epoch;
use base::id::{
BroadcastChannelRouterId, BrowsingContextId, HistoryStateId, MessagePortId,
MessagePortRouterId, PipelineId, ServiceWorkerId, ServiceWorkerRegistrationId,
TopLevelBrowsingContextId,
};
use base::Epoch;
use canvas_traits::canvas::{CanvasId, CanvasMsg};
use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId};
use embedder_traits::{
EmbedderMsg, MediaSessionEvent, TouchEventType, TouchSequenceId, TraversalDirection,
};
use euclid::default::Size2D as UntypedSize2D;
use euclid::Size2D;
use euclid::default::Size2D as UntypedSize2D;
use ipc_channel::ipc::{IpcReceiver, IpcSender};
use net_traits::storage_thread::StorageType;
use net_traits::CoreResourceMsg;
use net_traits::storage_thread::StorageType;
use serde::{Deserialize, Serialize};
use servo_url::{ImmutableOrigin, ServoUrl};
use style_traits::CSSPixel;
#[cfg(feature = "webgpu")]
use webgpu::{wgc, WebGPU, WebGPUResponse};
use webgpu::{WebGPU, WebGPUResponse, wgc};
use crate::{
AnimationState, AuxiliaryWebViewCreationRequest, BroadcastMsg, DocumentState,

View file

@ -12,17 +12,17 @@ pub mod wrapper_traits;
use std::any::Any;
use std::borrow::Cow;
use std::sync::atomic::{AtomicIsize, AtomicU64, Ordering};
use std::sync::Arc;
use std::sync::atomic::{AtomicIsize, AtomicU64, Ordering};
use app_units::Au;
use atomic_refcell::AtomicRefCell;
use base::Epoch;
use base::cross_process_instant::CrossProcessInstant;
use base::id::{BrowsingContextId, PipelineId, WebViewId};
use base::Epoch;
use canvas_traits::canvas::{CanvasId, CanvasMsg};
use euclid::default::{Point2D, Rect};
use euclid::Size2D;
use euclid::default::{Point2D, Rect};
use fnv::FnvHashMap;
use fonts::{FontContext, SystemFontServiceProxy};
use ipc_channel::ipc::IpcSender;
@ -39,18 +39,18 @@ use script_traits::{
use serde::{Deserialize, Serialize};
use servo_arc::Arc as ServoArc;
use servo_url::{ImmutableOrigin, ServoUrl};
use style::Atom;
use style::animation::DocumentAnimationSet;
use style::context::QuirksMode;
use style::data::ElementData;
use style::dom::OpaqueNode;
use style::invalidation::element::restyle_hints::RestyleHint;
use style::media_queries::Device;
use style::properties::style_structs::Font;
use style::properties::PropertyId;
use style::properties::style_structs::Font;
use style::queries::values::PrefersColorScheme;
use style::selector_parser::{PseudoElement, RestyleDamage, Snapshot};
use style::stylesheets::Stylesheet;
use style::Atom;
use style_traits::CSSPixel;
use webrender_api::ImageKey;
use webrender_traits::CrossProcessCompositorApi;

View file

@ -11,7 +11,7 @@ use std::sync::Arc as StdArc;
use atomic_refcell::AtomicRef;
use base::id::{BrowsingContextId, PipelineId};
use fonts_traits::ByteIndex;
use html5ever::{local_name, namespace_url, ns, LocalName, Namespace};
use html5ever::{LocalName, Namespace, local_name, namespace_url, ns};
use pixels::{Image, ImageMetadata};
use range::Range;
use servo_arc::Arc;
@ -323,10 +323,7 @@ pub trait ThreadSafeLayoutNode<'dom>: Clone + Copy + Debug + NodeInfo + PartialE
pub trait ThreadSafeLayoutElement<'dom>:
Clone + Copy + Sized + Debug + ::selectors::Element<Impl = SelectorImpl>
{
type ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<
'dom,
ConcreteThreadSafeLayoutElement = Self,
>;
type ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<'dom, ConcreteThreadSafeLayoutElement = Self>;
/// This type alias is just a work-around to avoid writing
///

View file

@ -17,8 +17,8 @@ use glow::NativeFramebuffer;
use image::RgbaImage;
use log::{debug, trace, warn};
use raw_window_handle::{DisplayHandle, WindowHandle};
use surfman::chains::{PreserveBuffer, SwapChain};
pub use surfman::Error;
use surfman::chains::{PreserveBuffer, SwapChain};
use surfman::{
Adapter, Connection, Context, ContextAttributeFlags, ContextAttributes, Device, GLApi,
NativeContext, NativeWidget, Surface, SurfaceAccess, SurfaceInfo, SurfaceTexture, SurfaceType,

View file

@ -46,7 +46,7 @@ impl GLContexts<()> for () {
pub trait LayerGrandManagerAPI<GL: GLTypes> {
fn create_layer_manager(&self, factory: LayerManagerFactory<GL>)
-> Result<LayerManager, Error>;
-> Result<LayerManager, Error>;
fn clone_layer_grand_manager(&self) -> LayerGrandManager<GL>;
}

View file

@ -37,11 +37,11 @@ pub use input::{
Handedness, InputFrame, InputId, InputSource, SelectEvent, SelectKind, TargetRayMode,
};
#[cfg(feature = "ipc")]
pub use ipc_channel::ipc::channel as webxr_channel;
#[cfg(feature = "ipc")]
pub use ipc_channel::ipc::IpcReceiver as WebXrReceiver;
#[cfg(feature = "ipc")]
pub use ipc_channel::ipc::IpcSender as WebXrSender;
#[cfg(feature = "ipc")]
pub use ipc_channel::ipc::channel as webxr_channel;
pub use layer::{
ContextId, GLContexts, GLTypes, LayerGrandManager, LayerGrandManagerAPI, LayerId, LayerInit,
LayerLayout, LayerManager, LayerManagerAPI, LayerManagerFactory, SubImage, SubImages,
@ -57,9 +57,9 @@ pub use session::{
};
pub use space::{ApiSpace, BaseSpace, Space};
pub use view::{
Capture, CubeBack, CubeBottom, CubeLeft, CubeRight, CubeTop, Display, Floor, Input, LeftEye,
Native, RightEye, SomeEye, View, Viewer, Viewport, Viewports, Views, CUBE_BACK, CUBE_BOTTOM,
CUBE_LEFT, CUBE_RIGHT, CUBE_TOP, LEFT_EYE, RIGHT_EYE, VIEWER,
CUBE_BACK, CUBE_BOTTOM, CUBE_LEFT, CUBE_RIGHT, CUBE_TOP, Capture, CubeBack, CubeBottom,
CubeLeft, CubeRight, CubeTop, Display, Floor, Input, LEFT_EYE, LeftEye, Native, RIGHT_EYE,
RightEye, SomeEye, VIEWER, View, Viewer, Viewport, Viewports, Views,
};
#[cfg(not(feature = "ipc"))]

View file

@ -11,9 +11,9 @@ use log::warn;
use serde::{Deserialize, Serialize};
use crate::{
webxr_channel, ContextId, DeviceAPI, Error, Event, Floor, Frame, FrameUpdateEvent, HitTestId,
HitTestSource, InputSource, LayerGrandManager, LayerId, LayerInit, Native, Viewport, Viewports,
WebXrReceiver, WebXrSender,
ContextId, DeviceAPI, Error, Event, Floor, Frame, FrameUpdateEvent, HitTestId, HitTestSource,
InputSource, LayerGrandManager, LayerId, LayerInit, Native, Viewport, Viewports, WebXrReceiver,
WebXrSender, webxr_channel,
};
// How long to wait for an rAF.