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

Switch some crates to the 2018 edition #22086

Merged
merged 8 commits into from Nov 6, 2018

`cargo fix --edition`

  • Loading branch information
SimonSapin committed Nov 6, 2018
commit 45f7199eee82c66637ec68287eafa40a651001c4
@@ -7,7 +7,7 @@
#[global_allocator]
static ALLOC: Allocator = Allocator;

pub use platform::*;
pub use crate::platform::*;

#[cfg(not(windows))]
mod platform {
@@ -2,7 +2,7 @@
* 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 BluetoothManager;
use crate::BluetoothManager;
use device::bluetooth::{BluetoothAdapter, BluetoothDevice};
use device::bluetooth::{BluetoothGATTCharacteristic, BluetoothGATTDescriptor, BluetoothGATTService};
use std::borrow::ToOwned;
@@ -12,7 +12,7 @@ pub mod blocklist;
pub mod scanfilter;

use ipc_channel::ipc::IpcSender;
use scanfilter::{BluetoothScanfilterSequence, RequestDeviceoptions};
use crate::scanfilter::{BluetoothScanfilterSequence, RequestDeviceoptions};

#[derive(Debug, Deserialize, Serialize)]
pub enum BluetoothError {
@@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use azure::azure_hl::AntialiasMode;
use canvas_data::*;
use crate::canvas_data::*;
use canvas_traits::canvas::*;
use euclid::Size2D;
use ipc_channel::ipc::{self, IpcSender};
@@ -2,7 +2,7 @@
* 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 ::gl_context::GLContextFactory;
use crate::gl_context::GLContextFactory;
use canvas_traits::webgl::{WebGLChan, WebGLContextId, WebGLMsg, WebGLPipeline, WebGLReceiver};
use canvas_traits::webgl::{WebGLSender, WebVRCommand, WebVRRenderHandler};
use canvas_traits::webgl::DOMToTextureCommand;
@@ -12,7 +12,7 @@ use fnv::FnvHashMap;
use gleam::gl;
use servo_config::prefs::PREFS;
use std::rc::Rc;
use webgl_thread::{WebGLExternalImageApi, WebGLExternalImageHandler, WebGLThread};
use crate::webgl_thread::{WebGLExternalImageApi, WebGLExternalImageHandler, WebGLThread};
use webrender;
use webrender_api;

@@ -15,7 +15,7 @@ use webrender_api;

/// WebGL Threading API entry point that lives in the constellation.
/// It allows to get a WebGLThread handle for each script pipeline.
pub use ::webgl_mode::WebGLThreads;
pub use crate::webgl_mode::WebGLThreads;

struct GLContextData {
ctx: GLContextWrapper,
@@ -12,17 +12,17 @@ use std::num::NonZeroU32;
use webrender_api::{DocumentId, ImageKey, PipelineId};

/// Sender type used in WebGLCommands.
pub use ::webgl_channel::WebGLSender;
pub use crate::webgl_channel::WebGLSender;
/// Receiver type used in WebGLCommands.
pub use ::webgl_channel::WebGLReceiver;
pub use crate::webgl_channel::WebGLReceiver;
/// Result type for send()/recv() calls in in WebGLCommands.
pub use ::webgl_channel::WebGLSendResult;
pub use crate::webgl_channel::WebGLSendResult;
/// Helper function that creates a WebGL channel (WebGLSender, WebGLReceiver) to be used in WebGLCommands.
pub use ::webgl_channel::webgl_channel;
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 ::webgl_channel::WebGLPipeline;
pub use crate::webgl_channel::WebGLPipeline;
/// Entry point channel type used for sending WebGLMsg messages to the WebGL renderer.
pub use ::webgl_channel::WebGLChan;
pub use crate::webgl_channel::WebGLChan;

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct WebGLCommandBacktrace {
@@ -342,7 +342,7 @@ macro_rules! define_resource_id {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: ::serde::Deserializer<'de>
{
let id = try!(u32::deserialize(deserializer));
let id = r#try!(u32::deserialize(deserializer));
This conversation was marked as resolved by SimonSapin

This comment has been minimized.

Copy link
@KiChjang

KiChjang Nov 1, 2018

Member

Can this just be

Suggested change
let id = r#try!(u32::deserialize(deserializer));
let id = u32::deserialize(deserializer)?;

This comment has been minimized.

Copy link
@SimonSapin

SimonSapin Nov 2, 2018

Author Member

Thanks!

if id == 0 {
Err(::serde::de::Error::custom("expected a non-zero value"))
} else {
@@ -7,7 +7,7 @@
mod ipc;
mod mpsc;

use ::webgl::WebGLMsg;
use crate::webgl::WebGLMsg;
use serde::{Deserialize, Serialize};
use servo_config::opts;
use std::fmt;
@@ -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 CompositionPipeline;
use SendableFrameTree;
use compositor_thread::{CompositorProxy, CompositorReceiver};
use compositor_thread::{InitialCompositorState, Msg};
use crate::CompositionPipeline;
use crate::SendableFrameTree;
use crate::compositor_thread::{CompositorProxy, CompositorReceiver};
use crate::compositor_thread::{InitialCompositorState, Msg};
use euclid::{TypedPoint2D, TypedVector2D, TypedScale};
use gfx_traits::Epoch;
#[cfg(feature = "gleam")]
use gl;
use crate::gl;
#[cfg(feature = "gleam")]
use image::{DynamicImage, ImageFormat};
use ipc_channel::ipc;
@@ -36,11 +36,11 @@ use style_traits::{CSSPixel, DevicePixel, PinchZoomFactor};
use style_traits::cursor::CursorKind;
use style_traits::viewport::ViewportConstraints;
use time::{now, precise_time_ns, precise_time_s};
use touch::{TouchHandler, TouchAction};
use crate::touch::{TouchHandler, TouchAction};
use webrender;
use webrender_api::{self, DeviceIntPoint, DevicePoint, HitTestFlags, HitTestResult};
use webrender_api::{LayoutVector2D, ScrollLocation};
use windowing::{self, EmbedderCoordinates, MouseWindowEvent, WebRenderDebugOption, WindowMethods};
use crate::windowing::{self, EmbedderCoordinates, MouseWindowEvent, WebRenderDebugOption, WindowMethods};

#[derive(Debug, PartialEq)]
enum UnableToComposite {
@@ -4,8 +4,8 @@

//! Communication with the compositor thread.

use SendableFrameTree;
use compositor::CompositingReason;
use crate::SendableFrameTree;
use crate::compositor::CompositingReason;
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 compositor_thread::CompositorProxy;
pub use compositor::IOCompositor;
pub use compositor::RenderNotifier;
pub use compositor::ShutdownState;
pub use crate::compositor_thread::CompositorProxy;
pub use crate::compositor::IOCompositor;
pub use crate::compositor::RenderNotifier;
pub use crate::compositor::ShutdownState;
use euclid::TypedSize2D;
use ipc_channel::ipc::IpcSender;
use msg::constellation_msg::PipelineId;
@@ -8,7 +8,7 @@
use euclid::TypedSize2D;
use getopts::Options;
use num_cpus;
use prefs::{self, PrefValue, PREFS};
use crate::prefs::{self, PrefValue, PREFS};
use servo_geometry::DeviceIndependentPixel;
use servo_url::ServoUrl;
use std::borrow::Cow;
@@ -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 basedir::default_config_dir;
use crate::basedir::default_config_dir;
use embedder_traits::resources::{self, Resource};
use num_cpus;
use opts;
use crate::opts;
use rustc_serialize::json::{Json, ToJson};
use std::borrow::ToOwned;
use std::cmp::max;
@@ -4,7 +4,7 @@

use euclid::TypedSize2D;
use msg::constellation_msg::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId};
use pipeline::Pipeline;
use crate::pipeline::Pipeline;
use std::collections::{HashMap, HashSet};
use style_traits::CSSPixel;

@@ -91,8 +91,8 @@

use backtrace::Backtrace;
use bluetooth_traits::BluetoothRequest;
use browsingcontext::{AllBrowsingContextsIterator, BrowsingContext, FullyActiveBrowsingContextsIterator};
use browsingcontext::NewBrowsingContextInfo;
use crate::browsingcontext::{AllBrowsingContextsIterator, BrowsingContext, FullyActiveBrowsingContextsIterator};
use crate::browsingcontext::NewBrowsingContextInfo;
use canvas::canvas_paint_thread::CanvasPaintThread;
use canvas::webgl_thread::WebGLThreads;
use canvas_traits::canvas::CanvasId;
@@ -105,7 +105,7 @@ use debugger;
use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg};
use embedder_traits::{EmbedderMsg, EmbedderProxy};
use euclid::{Size2D, TypedSize2D, TypedScale};
use event_loop::EventLoop;
use crate::event_loop::EventLoop;
use gfx::font_cache_thread::FontCacheThread;
use gfx_traits::Epoch;
use ipc_channel::{Error as IpcError};
@@ -120,8 +120,8 @@ 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 network_listener::NetworkListener;
use pipeline::{InitialPipelineState, Pipeline};
use crate::network_listener::NetworkListener;
use crate::pipeline::{InitialPipelineState, Pipeline};
use profile_traits::mem;
use profile_traits::time;
use script_traits::{AnimationState, AuxiliaryBrowsingContextLoadInfo, AnimationTickType, CompositorEvent};
@@ -139,7 +139,7 @@ use servo_config::prefs::PREFS;
use servo_rand::{Rng, SeedableRng, ServoRng, random};
use servo_remutex::ReentrantMutex;
use servo_url::{Host, ImmutableOrigin, ServoUrl};
use session_history::{JointSessionHistory, NeedsToReload, SessionHistoryChange, SessionHistoryDiff};
use crate::session_history::{JointSessionHistory, NeedsToReload, SessionHistoryChange, SessionHistoryDiff};
use std::borrow::ToOwned;
use std::collections::{HashMap, VecDeque};
use std::marker::PhantomData;
@@ -151,7 +151,7 @@ use std::thread;
use style_traits::CSSPixel;
use style_traits::cursor::CursorKind;
use style_traits::viewport::ViewportConstraints;
use timer_scheduler::TimerScheduler;
use crate::timer_scheduler::TimerScheduler;
use webrender_api;
use webvr_traits::{WebVREvent, WebVRMsg};

@@ -53,7 +53,7 @@ mod sandboxing;
mod session_history;
mod timer_scheduler;

pub use constellation::{Constellation, FromCompositorLogger, FromScriptLogger, InitialConstellationState};
pub use pipeline::UnprivilegedPipelineContent;
pub use crate::constellation::{Constellation, FromCompositorLogger, FromScriptLogger, InitialConstellationState};
pub use crate::pipeline::UnprivilegedPipelineContent;
#[cfg(all(not(target_os = "windows"), not(target_os = "ios")))]
pub use sandboxing::content_process_sandbox_profile;
pub use crate::sandboxing::content_process_sandbox_profile;
@@ -9,7 +9,7 @@ use compositing::CompositorProxy;
use compositing::compositor_thread::Msg as CompositorMsg;
use devtools_traits::{DevtoolsControlMsg, ScriptToDevtoolsControlMsg};
use euclid::{TypedSize2D, TypedScale};
use event_loop::EventLoop;
use crate::event_loop::EventLoop;
use gfx::font_cache_thread::FontCacheThread;
use ipc_channel::Error;
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
@@ -557,7 +557,7 @@ impl UnprivilegedPipelineContent {
pub fn spawn_multiprocess(self) -> Result<(), Error> {
use gaol::sandbox::{self, Sandbox, SandboxMethods};
use ipc_channel::ipc::IpcOneShotServer;
use sandboxing::content_process_sandbox_profile;
use crate::sandboxing::content_process_sandbox_profile;

impl CommandMethods for sandbox::Command {
fn arg<T>(&mut self, arg: T)
@@ -2,7 +2,7 @@
* 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 browsingcontext::NewBrowsingContextInfo;
use crate::browsingcontext::NewBrowsingContextInfo;
use msg::constellation_msg::{BrowsingContextId, HistoryStateId, PipelineId, TopLevelBrowsingContextId};
use script_traits::LoadData;
use servo_url::ServoUrl;
@@ -7,10 +7,10 @@
//! Connection point for remote devtools that wish to investigate a particular Browsing Context's contents.
//! Supports dynamic attaching and detaching which control notifications of navigation, etc.

use actor::{Actor, ActorMessageStatus, ActorRegistry};
use actors::console::ConsoleActor;
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::actors::console::ConsoleActor;
use devtools_traits::DevtoolScriptControlMsg::{self, WantsLiveNotifications};
use protocol::JsonPacketStream;
use crate::protocol::JsonPacketStream;
use serde_json::{Map, Value};
use std::net::TcpStream;

@@ -7,15 +7,15 @@
//! Mediates interaction between the remote web console and equivalent functionality (object
//! inspection, JS evaluation, autocompletion) in Servo.

use actor::{Actor, ActorMessageStatus, ActorRegistry};
use actors::object::ObjectActor;
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::actors::object::ObjectActor;
use devtools_traits::{CachedConsoleMessageTypes, DevtoolScriptControlMsg};
use devtools_traits::CachedConsoleMessage;
use devtools_traits::EvaluateJSReply::{ActorValue, BooleanValue, StringValue};
use devtools_traits::EvaluateJSReply::{NullValue, NumberValue, VoidValue};
use ipc_channel::ipc::{self, IpcSender};
use msg::constellation_msg::PipelineId;
use protocol::JsonPacketStream;
use crate::protocol::JsonPacketStream;
use serde_json::{self, Map, Number, Value};
use std::cell::RefCell;
use std::net::TcpStream;
@@ -2,9 +2,9 @@
* 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 actor::{Actor, ActorMessageStatus, ActorRegistry};
use protocol::{ActorDescription, Method};
use protocol::JsonPacketStream;
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::protocol::{ActorDescription, Method};
use crate::protocol::JsonPacketStream;
use serde_json::{Map, Value};
use std::net::TcpStream;

@@ -2,7 +2,7 @@
* 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 actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use serde_json::{Map, Value};
use std::net::TcpStream;

@@ -2,8 +2,8 @@
* 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 actor::{Actor, ActorMessageStatus, ActorRegistry};
use actors::timeline::HighResolutionStamp;
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::actors::timeline::HighResolutionStamp;
use devtools_traits::DevtoolScriptControlMsg;
use ipc_channel::ipc::IpcSender;
use msg::constellation_msg::PipelineId;
@@ -5,13 +5,13 @@
//! Liberally derived from the [Firefox JS implementation]
//! (http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/inspector.js).

use actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use devtools_traits::{ComputedNodeLayout, DevtoolScriptControlMsg, NodeInfo};
use devtools_traits::DevtoolScriptControlMsg::{GetChildren, GetDocumentElement, GetRootNode};
use devtools_traits::DevtoolScriptControlMsg::{GetLayout, ModifyAttribute};
use ipc_channel::ipc::{self, IpcSender};
use msg::constellation_msg::PipelineId;
use protocol::JsonPacketStream;
use crate::protocol::JsonPacketStream;
use serde_json::{self, Map, Value};
use std::cell::RefCell;
use std::net::TcpStream;
@@ -2,7 +2,7 @@
* 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 actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use serde_json::{Map, Value};
use std::net::TcpStream;

@@ -6,14 +6,14 @@
//! (http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/webconsole.js).
//! Handles interaction with the remote web console on network events (HTTP requests, responses) in Servo.

use actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use devtools_traits::HttpRequest as DevtoolsHttpRequest;
use devtools_traits::HttpResponse as DevtoolsHttpResponse;
use headers_core::HeaderMapExt;
use headers_ext::{ContentType, Cookie};
use http::{header, HeaderMap};
use hyper::{Method, StatusCode};
use protocol::JsonPacketStream;
use crate::protocol::JsonPacketStream;
use serde_json::{Map, Value};
use std::net::TcpStream;
use time;
@@ -2,7 +2,7 @@
* 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 actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use serde_json::{Map, Value};
use std::net::TcpStream;

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