Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce rustfmt on CI #22126

Merged
merged 6 commits into from Nov 7, 2018
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
The table of contents is too big for display.

Always

Just for now

Reorder imports

  • Loading branch information
pyfisch committed Nov 6, 2018
commit 9e92eb205a2a12fe0be883e42cb7f82deebc9031
@@ -23,7 +23,7 @@ mod platform {

/// Memory allocation APIs compatible with libc
pub mod libc_compat {
pub use super::ffi::{malloc, realloc, free};
pub use super::ffi::{free, malloc, realloc};
}

pub struct Allocator;
@@ -98,8 +98,8 @@ mod platform {
mod platform {
extern crate kernel32;

pub use std::alloc::System as Allocator;
use self::kernel32::{GetProcessHeap, HeapSize, HeapValidate};
pub use std::alloc::System as Allocator;
use std::os::raw::c_void;

/// Get the size of a heap block.
@@ -6,7 +6,7 @@ extern crate string_cache_codegen;

use std::env;
use std::fs::File;
use std::io::{BufReader, BufRead};
use std::io::{BufRead, BufReader};
use std::path::Path;

fn main() {
@@ -16,11 +16,13 @@ extern crate uuid;

pub mod test;

use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist};
use bluetooth_traits::scanfilter::{
BluetoothScanfilter, BluetoothScanfilterSequence, RequestDeviceoptions,
};
use bluetooth_traits::{BluetoothCharacteristicMsg, BluetoothDescriptorMsg, BluetoothServiceMsg};
use bluetooth_traits::{BluetoothDeviceMsg, BluetoothRequest, BluetoothResponse, GATTType};
use bluetooth_traits::{BluetoothError, BluetoothResponseResult, BluetoothResult};
use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist};
use bluetooth_traits::scanfilter::{BluetoothScanfilter, BluetoothScanfilterSequence, RequestDeviceoptions};
use device::bluetooth::{BluetoothAdapter, BluetoothDevice, BluetoothGATTCharacteristic};
use device::bluetooth::{BluetoothGATTDescriptor, BluetoothGATTService};
use embedder_traits::{EmbedderMsg, EmbedderProxy};
@@ -4,10 +4,12 @@

use crate::BluetoothManager;
use device::bluetooth::{BluetoothAdapter, BluetoothDevice};
use device::bluetooth::{BluetoothGATTCharacteristic, BluetoothGATTDescriptor, BluetoothGATTService};
use device::bluetooth::{
BluetoothGATTCharacteristic, BluetoothGATTDescriptor, BluetoothGATTService,
};
use std::borrow::ToOwned;
use std::cell::RefCell;
use std::collections::{HashSet, HashMap};
use std::collections::{HashMap, HashSet};
use std::error::Error;
use std::string::String;
use uuid::Uuid;
@@ -3,14 +3,16 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use azure::azure::AzFloat;
use azure::azure_hl::SurfacePattern;
use azure::azure_hl::{AntialiasMode, CapStyle, CompositionOp, JoinStyle};
use azure::azure_hl::{BackendType, DrawOptions, DrawTarget, Pattern, StrokeOptions, SurfaceFormat};
use azure::azure_hl::{
BackendType, DrawOptions, DrawTarget, Pattern, StrokeOptions, SurfaceFormat,
};
use azure::azure_hl::{Color, ColorPattern, DrawSurfaceOptions, Filter, PathBuilder};
use azure::azure_hl::{ExtendMode, GradientStop, LinearGradientPattern, RadialGradientPattern};
use azure::azure_hl::SurfacePattern;
use canvas_traits::canvas::*;
use cssparser::RGBA;
use euclid::{Transform2D, Point2D, Vector2D, Rect, Size2D};
use euclid::{Point2D, Rect, Size2D, Transform2D, Vector2D};
use ipc_channel::ipc::IpcSender;
use num_traits::ToPrimitive;
use pixels;
@@ -2,16 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use canvas_traits::webgl::{WebGLCommand, WebGLVersion, WebGLCommandBacktrace};
use compositing::compositor_thread::{CompositorProxy, self};
use super::webgl_thread::{GLState, WebGLImpl};
use canvas_traits::webgl::{WebGLCommand, WebGLCommandBacktrace, WebGLVersion};
use compositing::compositor_thread::{self, CompositorProxy};
use euclid::Size2D;
use gleam::gl;
use offscreen_gl_context::{ColorAttachmentType, GLContext, GLContextAttributes, GLContextDispatcher};
use offscreen_gl_context::{
ColorAttachmentType, GLContext, GLContextAttributes, GLContextDispatcher,
};
use offscreen_gl_context::{GLLimits, GLVersion};
use offscreen_gl_context::{NativeGLContext, NativeGLContextHandle, NativeGLContextMethods};
use offscreen_gl_context::{OSMesaContext, OSMesaContextHandle};
use std::sync::{Arc, Mutex};
use super::webgl_thread::{WebGLImpl, GLState};

/// The GLContextFactory is used to create shared GL contexts with the main thread GL context.
/// Currently, shared textures are used to render WebGL textures into the WR compositor.
@@ -2,10 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use canvas_traits::webgl::webgl_channel;
use canvas_traits::webgl::DOMToTextureCommand;
use canvas_traits::webgl::{WebGLChan, WebGLContextId, WebGLMsg, WebGLPipeline, WebGLReceiver};
use canvas_traits::webgl::{WebGLSender, WebVRCommand, WebVRRenderHandler};
use canvas_traits::webgl::DOMToTextureCommand;
use canvas_traits::webgl::webgl_channel;
use crate::gl_context::GLContextFactory;
use crate::webgl_thread::{WebGLExternalImageApi, WebGLExternalImageHandler, WebGLThread};
use euclid::Size2D;
@@ -2,14 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use super::gl_context::{GLContextFactory, GLContextWrapper};
use canvas_traits::webgl::*;
use euclid::Size2D;
use fnv::FnvHashMap;
use gleam::gl;
use offscreen_gl_context::{GLContext, GLContextAttributes, GLLimits, NativeGLContextMethods};
use pixels;
use std::thread;
use super::gl_context::{GLContextFactory, GLContextWrapper};
use webrender;
use webrender_api;

@@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use cssparser::RGBA;
use euclid::{Transform2D, Point2D, Rect, Size2D};
use euclid::{Point2D, Rect, Size2D, Transform2D};
use ipc_channel::ipc::{IpcBytesReceiver, IpcBytesSender, IpcSender};
use serde_bytes::ByteBuf;
use std::default::Default;
@@ -11,18 +11,18 @@ use std::borrow::Cow;
use std::num::NonZeroU32;
use webrender_api::{DocumentId, ImageKey, PipelineId};

/// Sender type used in WebGLCommands.
pub use crate::webgl_channel::WebGLSender;
/// Receiver type used in WebGLCommands.
pub use crate::webgl_channel::WebGLReceiver;
/// Result type for send()/recv() calls in in WebGLCommands.
pub use crate::webgl_channel::WebGLSendResult;
/// Helper function that creates a WebGL channel (WebGLSender, WebGLReceiver) to be used in WebGLCommands.
pub use crate::webgl_channel::webgl_channel;
/// Entry point type used in a Script Pipeline to get the WebGLChan to be used in that thread.
pub use crate::webgl_channel::WebGLPipeline;
/// Entry point channel type used for sending WebGLMsg messages to the WebGL renderer.
pub use crate::webgl_channel::WebGLChan;
/// Entry point type used in a Script Pipeline to get the WebGLChan to be used in that thread.
pub use crate::webgl_channel::WebGLPipeline;
/// Receiver type used in WebGLCommands.
pub use crate::webgl_channel::WebGLReceiver;
/// Result type for send()/recv() calls in in WebGLCommands.
pub use crate::webgl_channel::WebGLSendResult;
/// Sender type used in WebGLCommands.
pub use crate::webgl_channel::WebGLSender;

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct WebGLCommandBacktrace {
@@ -15,8 +15,8 @@ pub use crossbeam_channel::*;
use ipc_channel::ipc::IpcReceiver;
use ipc_channel::router::ROUTER;
use serde::{Deserialize, Serialize};
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;

pub fn route_ipc_receiver_to_new_servo_receiver<T>(ipc_receiver: IpcReceiver<T>) -> Receiver<T>
where
@@ -2,15 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use crate::CompositionPipeline;
use crate::SendableFrameTree;
use crate::compositor_thread::{CompositorProxy, CompositorReceiver};
use crate::compositor_thread::{InitialCompositorState, Msg};
#[cfg(feature = "gleam")]
use crate::gl;
use crate::touch::{TouchHandler, TouchAction};
use crate::windowing::{self, EmbedderCoordinates, MouseWindowEvent, WebRenderDebugOption, WindowMethods};
use euclid::{TypedPoint2D, TypedVector2D, TypedScale};
use crate::touch::{TouchAction, TouchHandler};
use crate::windowing::{
self, EmbedderCoordinates, MouseWindowEvent, WebRenderDebugOption, WindowMethods,
};
use crate::CompositionPipeline;
use crate::SendableFrameTree;
use euclid::{TypedPoint2D, TypedScale, TypedVector2D};
use gfx_traits::Epoch;
#[cfg(feature = "gleam")]
use image::{DynamicImage, ImageFormat};
@@ -20,23 +22,23 @@ use msg::constellation_msg::{PipelineId, PipelineIndex, PipelineNamespaceId};
use net_traits::image::base::Image;
#[cfg(feature = "gleam")]
use net_traits::image::base::PixelFormat;
use profile_traits::time::{self as profile_time, ProfilerCategory, profile};
use profile_traits::time::{self as profile_time, profile, ProfilerCategory};
use script_traits::CompositorEvent::{MouseButtonEvent, MouseMoveEvent, TouchEvent};
use script_traits::{AnimationState, AnimationTickType, ConstellationMsg, LayoutControlMsg};
use script_traits::{MouseButton, MouseEventType, ScrollState, TouchEventType, TouchId};
use script_traits::{UntrustedNodeAddress, WindowSizeData, WindowSizeType};
use script_traits::CompositorEvent::{MouseMoveEvent, MouseButtonEvent, TouchEvent};
use servo_channel::Sender;
use servo_config::opts;
use servo_geometry::DeviceIndependentPixel;
use std::collections::HashMap;
use std::env;
use std::fs::{File, create_dir_all};
use std::fs::{create_dir_all, File};
use std::io::Write;
use std::num::NonZeroU32;
use std::rc::Rc;
use style_traits::{CSSPixel, DevicePixel, PinchZoomFactor};
use style_traits::cursor::CursorKind;
use style_traits::viewport::ViewportConstraints;
use style_traits::{CSSPixel, DevicePixel, PinchZoomFactor};
use time::{now, precise_time_ns, precise_time_s};
use webrender;
use webrender_api::{self, DeviceIntPoint, DevicePoint, HitTestFlags, HitTestResult};
@@ -4,8 +4,8 @@

//! Communication with the compositor thread.

use crate::SendableFrameTree;
use crate::compositor::CompositingReason;
use crate::SendableFrameTree;
use embedder_traits::EventLoopWaker;
use gfx_traits::Epoch;
use ipc_channel::ipc::IpcSender;
@@ -29,10 +29,10 @@ extern crate time;
extern crate webrender;
extern crate webrender_api;

pub use crate::compositor_thread::CompositorProxy;
pub use crate::compositor::IOCompositor;
pub use crate::compositor::RenderNotifier;
pub use crate::compositor::ShutdownState;
pub use crate::compositor_thread::CompositorProxy;
use euclid::TypedSize2D;
use ipc_channel::ipc::IpcSender;
use msg::constellation_msg::PipelineId;
@@ -2,10 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use euclid::{TypedPoint2D, TypedVector2D};
use self::TouchState::*;
use euclid::TypedScale;
use euclid::{TypedPoint2D, TypedVector2D};
use script_traits::{EventResult, TouchId};
use self::TouchState::*;
use style_traits::DevicePixel;

/// Minimum number of `DeviceIndependentPixel` to begin touch scrolling.
@@ -17,7 +17,7 @@ use std::fmt::{Debug, Error, Formatter};
#[cfg(feature = "gleam")]
use std::rc::Rc;
use style_traits::DevicePixel;
use webrender_api::{DeviceIntPoint, DevicePoint, DeviceUintSize, DeviceUintRect, ScrollLocation};
use webrender_api::{DeviceIntPoint, DevicePoint, DeviceUintRect, DeviceUintSize, ScrollLocation};

#[derive(Clone)]
pub enum MouseWindowEvent {
@@ -19,7 +19,7 @@ use std::fs::{self, File};
use std::io::{self, Read, Write};
use std::path::{Path, PathBuf};
use std::process;
use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering};
use std::sync::atomic::{AtomicBool, Ordering, ATOMIC_BOOL_INIT};
use url::{self, Url};

/// Global flags for Servo, currently set on the command line.
@@ -11,7 +11,7 @@ use std::borrow::ToOwned;
use std::cmp::max;
use std::collections::HashMap;
use std::fs::File;
use std::io::{Read, Write, stderr};
use std::io::{stderr, Read, Write};
use std::path::PathBuf;
use std::sync::{Arc, RwLock};

@@ -4,7 +4,7 @@

extern crate servo_config;

use servo_config::opts::{parse_url_or_filename, parse_pref_from_command_line};
use servo_config::opts::{parse_pref_from_command_line, parse_url_or_filename};
use servo_config::prefs::{PrefValue, PREFS};
use std::path::Path;

@@ -5,7 +5,7 @@
extern crate servo_config;

use servo_config::basedir;
use servo_config::prefs::{PREFS, PrefValue, read_prefs};
use servo_config::prefs::{read_prefs, PrefValue, PREFS};
use std::fs::{self, File};
use std::io::{Read, Write};

@@ -96,49 +96,61 @@ use canvas::webgl_thread::WebGLThreads;
use canvas_traits::canvas::CanvasId;
use canvas_traits::canvas::CanvasMsg;
use clipboard::{ClipboardContext, ClipboardProvider};
use compositing::SendableFrameTree;
use compositing::compositor_thread::CompositorProxy;
use compositing::compositor_thread::Msg as ToCompositorMsg;
use crate::browsingcontext::{AllBrowsingContextsIterator, BrowsingContext, FullyActiveBrowsingContextsIterator};
use compositing::SendableFrameTree;
use crate::browsingcontext::NewBrowsingContextInfo;
use crate::browsingcontext::{
AllBrowsingContextsIterator, BrowsingContext, FullyActiveBrowsingContextsIterator,
};
use crate::event_loop::EventLoop;
use crate::network_listener::NetworkListener;
use crate::pipeline::{InitialPipelineState, Pipeline};
use crate::session_history::{JointSessionHistory, NeedsToReload, SessionHistoryChange, SessionHistoryDiff};
use crate::session_history::{
JointSessionHistory, NeedsToReload, SessionHistoryChange, SessionHistoryDiff,
};
use crate::timer_scheduler::TimerScheduler;
use debugger;
use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg};
use embedder_traits::{EmbedderMsg, EmbedderProxy};
use euclid::{Size2D, TypedSize2D, TypedScale};
use euclid::{Size2D, TypedScale, TypedSize2D};
use gfx::font_cache_thread::FontCacheThread;
use gfx_traits::Epoch;
use ipc_channel::{Error as IpcError};
use ipc_channel::ipc::{self, IpcSender, IpcReceiver};
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER;
use ipc_channel::Error as IpcError;
use keyboard_types::KeyboardEvent;
use layout_traits::LayoutThreadFactory;
use log::{Log, Level, LevelFilter, Metadata, Record};
use msg::constellation_msg::{BrowsingContextId, PipelineId, HistoryStateId, TopLevelBrowsingContextId};
use log::{Level, LevelFilter, Log, Metadata, Record};
use msg::constellation_msg::{
BrowsingContextId, HistoryStateId, PipelineId, TopLevelBrowsingContextId,
};
use msg::constellation_msg::{PipelineNamespace, PipelineNamespaceId, TraversalDirection};
use net_traits::{self, IpcSend, FetchResponseMsg, ResourceThreads};
use net_traits::pub_domains::reg_host;
use net_traits::request::RequestInit;
use net_traits::storage_thread::{StorageThreadMsg, StorageType};
use net_traits::{self, FetchResponseMsg, IpcSend, ResourceThreads};
use profile_traits::mem;
use profile_traits::time;
use script_traits::{AnimationState, AuxiliaryBrowsingContextLoadInfo, AnimationTickType, CompositorEvent};
use script_traits::{ConstellationControlMsg, ConstellationMsg as FromCompositorMsg, DiscardBrowsingContext};
use script_traits::{webdriver_msg, LogEntry, ScriptToConstellationChan, ServiceWorkerMsg};
use script_traits::{
AnimationState, AnimationTickType, AuxiliaryBrowsingContextLoadInfo, CompositorEvent,
};
use script_traits::{
ConstellationControlMsg, ConstellationMsg as FromCompositorMsg, DiscardBrowsingContext,
};
use script_traits::{DocumentActivity, DocumentState, LayoutControlMsg, LoadData};
use script_traits::{IFrameLoadInfo, IFrameLoadInfoWithData, IFrameSandboxState, TimerSchedulerMsg};
use script_traits::{
IFrameLoadInfo, IFrameLoadInfoWithData, IFrameSandboxState, TimerSchedulerMsg,
};
use script_traits::{LayoutMsg as FromLayoutMsg, ScriptMsg as FromScriptMsg, ScriptThreadFactory};
use script_traits::{LogEntry, ScriptToConstellationChan, ServiceWorkerMsg, webdriver_msg};
use script_traits::{SWManagerMsg, ScopeThings, UpdatePipelineIdReason, WebDriverCommandMsg};
use script_traits::{WindowSizeData, WindowSizeType};
use serde::{Deserialize, Serialize};
use servo_channel::{Receiver, Sender, channel};
use servo_channel::{channel, Receiver, Sender};
use servo_config::opts;
use servo_config::prefs::PREFS;
use servo_rand::{Rng, SeedableRng, ServoRng, random};
use servo_rand::{random, Rng, SeedableRng, ServoRng};
use servo_remutex::ReentrantMutex;
use servo_url::{Host, ImmutableOrigin, ServoUrl};
use std::borrow::ToOwned;
@@ -149,9 +161,9 @@ use std::process;
use std::rc::{Rc, Weak};
use std::sync::Arc;
use std::thread;
use style_traits::CSSPixel;
use style_traits::cursor::CursorKind;
use style_traits::viewport::ViewportConstraints;
use style_traits::CSSPixel;
use webrender_api;
use webvr_traits::{WebVREvent, WebVRMsg};

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.