mirror of
https://github.com/servo/servo.git
synced 2025-08-13 01:15:34 +01:00
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:
parent
6300e820b4
commit
3d320fa96a
603 changed files with 1739 additions and 1648 deletions
|
@ -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);
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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`].
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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 {}
|
||||
|
|
|
@ -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) {}
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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) };
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
},
|
||||
};
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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"))]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue