aboutsummaryrefslogtreecommitdiffstats
path: root/ports
diff options
context:
space:
mode:
authorSimon Wülker <simon.wuelker@arcor.de>2025-03-03 12:26:53 +0100
committerGitHub <noreply@github.com>2025-03-03 11:26:53 +0000
commit3d320fa96ae2ca95a720c454c47ee7827864c5af (patch)
tree1b7718d574cb9164d924b7571760d90d6d2099c4 /ports
parent6300e820b4e3fbfcec260048f931528d4998d5e4 (diff)
downloadservo-3d320fa96ae2ca95a720c454c47ee7827864c5af.tar.gz
servo-3d320fa96ae2ca95a720c454c47ee7827864c5af.zip
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>
Diffstat (limited to 'ports')
-rw-r--r--ports/servoshell/desktop/accelerated_gl_media.rs4
-rw-r--r--ports/servoshell/desktop/app_state.rs4
-rw-r--r--ports/servoshell/desktop/cli.rs2
-rw-r--r--ports/servoshell/desktop/egui_glue.rs2
-rw-r--r--ports/servoshell/desktop/headed_window.rs6
-rw-r--r--ports/servoshell/desktop/minibrowser.rs4
-rw-r--r--ports/servoshell/desktop/protocols/resource.rs2
-rw-r--r--ports/servoshell/desktop/protocols/urlinfo.rs2
-rw-r--r--ports/servoshell/desktop/window_trait.rs2
-rw-r--r--ports/servoshell/egl/android.rs2
-rw-r--r--ports/servoshell/egl/android/simpleservo.rs6
-rw-r--r--ports/servoshell/egl/app_state.rs2
-rw-r--r--ports/servoshell/egl/log.rs4
-rw-r--r--ports/servoshell/egl/ohos.rs4
-rw-r--r--ports/servoshell/egl/ohos/simpleservo.rs6
-rw-r--r--ports/servoshell/prefs.rs2
16 files changed, 28 insertions, 26 deletions
diff --git a/ports/servoshell/desktop/accelerated_gl_media.rs b/ports/servoshell/desktop/accelerated_gl_media.rs
index 1ee9011a48c..fe0267a5b2a 100644
--- a/ports/servoshell/desktop/accelerated_gl_media.rs
+++ b/ports/servoshell/desktop/accelerated_gl_media.rs
@@ -14,8 +14,8 @@ pub(crate) fn setup_gl_accelerated_media(_: RefMut<Device>, _: RefMut<Context>)
#[cfg(all(target_os = "linux", not(target_env = "ohos")))]
pub(crate) fn setup_gl_accelerated_media(device: RefMut<Device>, context: RefMut<Context>) {
- use servo::media::{GlContext, NativeDisplay};
use servo::Servo;
+ use servo::media::{GlContext, NativeDisplay};
use surfman::platform::generic::multi::connection::NativeConnection;
use surfman::platform::generic::multi::context::NativeContext;
@@ -43,8 +43,8 @@ pub(crate) fn setup_gl_accelerated_media(device: RefMut<Device>, context: RefMut
#[cfg(target_os = "windows")]
pub(crate) fn setup_gl_accelerated_media(device: RefMut<Device>, context: RefMut<Context>) {
- use servo::media::{GlContext, NativeDisplay};
use servo::Servo;
+ use servo::media::{GlContext, NativeDisplay};
let api = api(&device, &context);
let context = GlContext::Egl(device.native_context(&context).egl_context as usize);
diff --git a/ports/servoshell/desktop/app_state.rs b/ports/servoshell/desktop/app_state.rs
index e4fa041d1fc..71881d41059 100644
--- a/ports/servoshell/desktop/app_state.rs
+++ b/ports/servoshell/desktop/app_state.rs
@@ -14,8 +14,8 @@ use log::{error, info};
use servo::base::id::WebViewId;
use servo::config::pref;
use servo::ipc_channel::ipc::IpcSender;
-use servo::webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize};
use servo::webrender_api::ScrollLocation;
+use servo::webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize};
use servo::{
AllowOrDenyRequest, AuthenticationRequest, FilterPattern, GamepadHapticEffectType, LoadStatus,
PermissionRequest, Servo, ServoDelegate, ServoError, SimpleDialog, TouchEventType, WebView,
@@ -27,7 +27,7 @@ use super::app::PumpResult;
use super::dialog::Dialog;
use super::gamepad::GamepadSupport;
use super::keyutils::CMD_OR_CONTROL;
-use super::window_trait::{WindowPortsMethods, LINE_HEIGHT};
+use super::window_trait::{LINE_HEIGHT, WindowPortsMethods};
use crate::prefs::ServoShellPreferences;
pub(crate) enum AppState {
diff --git a/ports/servoshell/desktop/cli.rs b/ports/servoshell/desktop/cli.rs
index a77e20a5009..88de5086504 100644
--- a/ports/servoshell/desktop/cli.rs
+++ b/ports/servoshell/desktop/cli.rs
@@ -7,7 +7,7 @@ use std::{env, panic};
use crate::desktop::app::App;
use crate::desktop::events_loop::EventsLoop;
use crate::panic_hook;
-use crate::prefs::{parse_command_line_arguments, ArgumentParsingResult};
+use crate::prefs::{ArgumentParsingResult, parse_command_line_arguments};
pub fn main() {
crate::crash_handler::install();
diff --git a/ports/servoshell/desktop/egui_glue.rs b/ports/servoshell/desktop/egui_glue.rs
index 6cc43ca3a66..78ccfdfae2d 100644
--- a/ports/servoshell/desktop/egui_glue.rs
+++ b/ports/servoshell/desktop/egui_glue.rs
@@ -36,8 +36,8 @@
use egui::{ViewportId, ViewportOutput};
use egui_glow::ShaderVersion;
pub use egui_winit;
-use egui_winit::winit;
pub use egui_winit::EventResponse;
+use egui_winit::winit;
use winit::event_loop::ActiveEventLoop;
/// Use [`egui`] from a [`glow`] app based on [`winit`].
diff --git a/ports/servoshell/desktop/headed_window.rs b/ports/servoshell/desktop/headed_window.rs
index 74ea438118e..16492d355a9 100644
--- a/ports/servoshell/desktop/headed_window.rs
+++ b/ports/servoshell/desktop/headed_window.rs
@@ -19,8 +19,8 @@ use servo::compositing::windowing::{
};
use servo::servo_config::pref;
use servo::servo_geometry::DeviceIndependentPixel;
-use servo::webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize, DevicePixel};
use servo::webrender_api::ScrollLocation;
+use servo::webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize, DevicePixel};
use servo::{
Cursor, ImeEvent, InputEvent, Key, KeyState, KeyboardEvent, MouseButton as ServoMouseButton,
MouseButtonAction, MouseButtonEvent, MouseMoveEvent, OffscreenRenderingContext,
@@ -40,8 +40,8 @@ use winit::window::Icon;
use super::app_state::RunningAppState;
use super::geometry::{winit_position_to_euclid_point, winit_size_to_euclid_size};
-use super::keyutils::{keyboard_event_from_winit, CMD_OR_ALT};
-use super::window_trait::{WindowPortsMethods, LINE_HEIGHT};
+use super::keyutils::{CMD_OR_ALT, keyboard_event_from_winit};
+use super::window_trait::{LINE_HEIGHT, WindowPortsMethods};
use crate::desktop::accelerated_gl_media::setup_gl_accelerated_media;
use crate::desktop::keyutils::CMD_OR_CONTROL;
use crate::prefs::ServoShellPreferences;
diff --git a/ports/servoshell/desktop/minibrowser.rs b/ports/servoshell/desktop/minibrowser.rs
index 3b6ccc42922..5eac3005048 100644
--- a/ports/servoshell/desktop/minibrowser.rs
+++ b/ports/servoshell/desktop/minibrowser.rs
@@ -11,8 +11,8 @@ use dpi::PhysicalSize;
use egui::text::{CCursor, CCursorRange};
use egui::text_edit::TextEditState;
use egui::{
- pos2, CentralPanel, Frame, Key, Label, Modifiers, PaintCallback, SelectableLabel,
- TopBottomPanel, Vec2,
+ CentralPanel, Frame, Key, Label, Modifiers, PaintCallback, SelectableLabel, TopBottomPanel,
+ Vec2, pos2,
};
use egui_glow::CallbackFn;
use egui_winit::EventResponse;
diff --git a/ports/servoshell/desktop/protocols/resource.rs b/ports/servoshell/desktop/protocols/resource.rs
index 3a719193e8e..d75966f7e97 100644
--- a/ports/servoshell/desktop/protocols/resource.rs
+++ b/ports/servoshell/desktop/protocols/resource.rs
@@ -16,10 +16,10 @@ use headers::{ContentType, HeaderMapExt};
use net::fetch::methods::{DoneChannel, FetchContext};
use net::filemanager_thread::FILE_CHUNK_SIZE;
use net::protocols::ProtocolHandler;
+use net_traits::ResourceFetchTiming;
use net_traits::filemanager_thread::RelativePos;
use net_traits::request::Request;
use net_traits::response::{Response, ResponseBody};
-use net_traits::ResourceFetchTiming;
use tokio::sync::mpsc::unbounded_channel;
#[derive(Default)]
diff --git a/ports/servoshell/desktop/protocols/urlinfo.rs b/ports/servoshell/desktop/protocols/urlinfo.rs
index a6efe5e57c4..4408ce47e52 100644
--- a/ports/servoshell/desktop/protocols/urlinfo.rs
+++ b/ports/servoshell/desktop/protocols/urlinfo.rs
@@ -8,10 +8,10 @@ use std::pin::Pin;
use headers::{ContentType, HeaderMapExt};
use net::fetch::methods::{DoneChannel, FetchContext};
use net::protocols::ProtocolHandler;
+use net_traits::ResourceFetchTiming;
use net_traits::http_status::HttpStatus;
use net_traits::request::Request;
use net_traits::response::{Response, ResponseBody};
-use net_traits::ResourceFetchTiming;
#[derive(Default)]
pub struct UrlInfoProtocolHander {}
diff --git a/ports/servoshell/desktop/window_trait.rs b/ports/servoshell/desktop/window_trait.rs
index 4c7b794412a..678e5142f75 100644
--- a/ports/servoshell/desktop/window_trait.rs
+++ b/ports/servoshell/desktop/window_trait.rs
@@ -35,7 +35,7 @@ pub trait WindowPortsMethods: WindowMethods {
fn set_title(&self, _title: &str) {}
/// Request a new inner size for the window, not including external decorations.
fn request_resize(&self, webview: &WebView, inner_size: DeviceIntSize)
- -> Option<DeviceIntSize>;
+ -> Option<DeviceIntSize>;
fn set_position(&self, _point: DeviceIntPoint) {}
fn set_fullscreen(&self, _state: bool) {}
fn set_cursor(&self, _cursor: Cursor) {}
diff --git a/ports/servoshell/egl/android.rs b/ports/servoshell/egl/android.rs
index 0f84dadfc14..3713c7c6f48 100644
--- a/ports/servoshell/egl/android.rs
+++ b/ports/servoshell/egl/android.rs
@@ -23,7 +23,7 @@ use servo::{
AlertResponse, LoadStatus, MediaSessionActionType, PermissionRequest, SimpleDialog, WebView,
};
use simpleservo::{
- DeviceIntRect, EventLoopWaker, InitOptions, InputMethodType, MediaSessionPlaybackState, APP,
+ APP, DeviceIntRect, EventLoopWaker, InitOptions, InputMethodType, MediaSessionPlaybackState,
};
use super::app_state::{Coordinates, RunningAppState};
diff --git a/ports/servoshell/egl/android/simpleservo.rs b/ports/servoshell/egl/android/simpleservo.rs
index 1dd255402d9..6ef42c95789 100644
--- a/ports/servoshell/egl/android/simpleservo.rs
+++ b/ports/servoshell/egl/android/simpleservo.rs
@@ -8,12 +8,12 @@ use std::rc::Rc;
use dpi::PhysicalSize;
use raw_window_handle::{DisplayHandle, RawDisplayHandle, RawWindowHandle, WindowHandle};
-pub use servo::webrender_api::units::DeviceIntRect;
/// The EventLoopWaker::wake function will be called from any thread.
/// It will be called to notify embedder that some events are available,
/// and that perform_updates need to be called
pub use servo::EventLoopWaker;
-use servo::{self, resources, Servo};
+pub use servo::webrender_api::units::DeviceIntRect;
+use servo::{self, Servo, resources};
pub use servo::{InputMethodType, MediaSessionPlaybackState, WindowRenderingContext};
use crate::egl::android::resources::ResourceReaderInstance;
@@ -21,7 +21,7 @@ use crate::egl::app_state::{
Coordinates, RunningAppState, ServoEmbedderCallbacks, ServoWindowCallbacks,
};
use crate::egl::host_trait::HostTrait;
-use crate::prefs::{parse_command_line_arguments, ArgumentParsingResult};
+use crate::prefs::{ArgumentParsingResult, parse_command_line_arguments};
thread_local! {
pub static APP: RefCell<Option<Rc<RunningAppState>>> = const { RefCell::new(None) };
diff --git a/ports/servoshell/egl/app_state.rs b/ports/servoshell/egl/app_state.rs
index d7b2e0a5333..bc3ea56a708 100644
--- a/ports/servoshell/egl/app_state.rs
+++ b/ports/servoshell/egl/app_state.rs
@@ -16,8 +16,8 @@ use servo::compositing::windowing::{
};
use servo::euclid::{Box2D, Point2D, Rect, Scale, Size2D, Vector2D};
use servo::servo_geometry::DeviceIndependentPixel;
-use servo::webrender_api::units::{DeviceIntRect, DeviceIntSize, DevicePixel};
use servo::webrender_api::ScrollLocation;
+use servo::webrender_api::units::{DeviceIntRect, DeviceIntSize, DevicePixel};
use servo::{
AllowOrDenyRequest, ContextMenuResult, EmbedderProxy, EventLoopWaker, ImeEvent, InputEvent,
InputMethodType, Key, KeyState, KeyboardEvent, LoadStatus, MediaSessionActionType,
diff --git a/ports/servoshell/egl/log.rs b/ports/servoshell/egl/log.rs
index db21de6d14c..86c86356a52 100644
--- a/ports/servoshell/egl/log.rs
+++ b/ports/servoshell/egl/log.rs
@@ -63,7 +63,9 @@ pub(crate) fn redirect_stdout_and_stderr() -> Result<(), LogRedirectError> {
Ok(bytes) => bytes + cursor,
Err(nix::errno::Errno::EINTR) => continue,
Err(e) => {
- error!("Failed to read from redirected stdout/stderr pipe due to {e:?}. Closing log thread");
+ error!(
+ "Failed to read from redirected stdout/stderr pipe due to {e:?}. Closing log thread"
+ );
return;
},
};
diff --git a/ports/servoshell/egl/ohos.rs b/ports/servoshell/egl/ohos.rs
index ebaab2c4d33..b40657925bc 100644
--- a/ports/servoshell/egl/ohos.rs
+++ b/ports/servoshell/egl/ohos.rs
@@ -7,13 +7,13 @@ use std::cell::RefCell;
use std::mem::MaybeUninit;
use std::os::raw::c_void;
use std::sync::mpsc::{Receiver, Sender};
-use std::sync::{mpsc, Once, OnceLock};
+use std::sync::{Once, OnceLock, mpsc};
use std::thread;
use std::thread::sleep;
use std::time::Duration;
use keyboard_types::Key;
-use log::{debug, error, info, trace, warn, LevelFilter};
+use log::{LevelFilter, debug, error, info, trace, warn};
use napi_derive_ohos::{module_exports, napi};
use napi_ohos::bindgen_prelude::Function;
use napi_ohos::threadsafe_function::{ThreadsafeFunction, ThreadsafeFunctionCallMode};
diff --git a/ports/servoshell/egl/ohos/simpleservo.rs b/ports/servoshell/egl/ohos/simpleservo.rs
index 77719eaa5f8..c4ccec07fce 100644
--- a/ports/servoshell/egl/ohos/simpleservo.rs
+++ b/ports/servoshell/egl/ohos/simpleservo.rs
@@ -17,16 +17,16 @@ use raw_window_handle::{
/// It will be called to notify embedder that some events are available,
/// and that perform_updates need to be called
pub use servo::EventLoopWaker;
-use servo::{self, resources, Servo, WindowRenderingContext};
+use servo::{self, Servo, WindowRenderingContext, resources};
use xcomponent_sys::OH_NativeXComponent;
use crate::egl::app_state::{
Coordinates, RunningAppState, ServoEmbedderCallbacks, ServoWindowCallbacks,
};
use crate::egl::host_trait::HostTrait;
-use crate::egl::ohos::resources::ResourceReaderInstance;
use crate::egl::ohos::InitOpts;
-use crate::prefs::{parse_command_line_arguments, ArgumentParsingResult};
+use crate::egl::ohos::resources::ResourceReaderInstance;
+use crate::prefs::{ArgumentParsingResult, parse_command_line_arguments};
/// Initialize Servo. At that point, we need a valid GL context.
/// In the future, this will be done in multiple steps.
diff --git a/ports/servoshell/prefs.rs b/ports/servoshell/prefs.rs
index 1aba21e267b..3b433d5beb7 100644
--- a/ports/servoshell/prefs.rs
+++ b/ports/servoshell/prefs.rs
@@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use std::collections::HashMap;
-use std::fs::{read_to_string, File};
+use std::fs::{File, read_to_string};
use std::io::Read;
use std::path::{Path, PathBuf};
#[cfg(any(target_os = "android", target_env = "ohos"))]