diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2018-11-08 05:11:11 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-08 05:11:11 -0500 |
commit | f220a63a0f4d7757c2a5e7c9da1c2063d37bebd6 (patch) | |
tree | b1a3c3010e6c29c4f9d86930f948116b6bf27a93 /components/compositing | |
parent | b1fd6237d1304f3d57abdafd3e6e738c1ece9f83 (diff) | |
parent | 9f977c52878e3638f475ca9a78e9f57d0d22893d (diff) | |
download | servo-f220a63a0f4d7757c2a5e7c9da1c2063d37bebd6.tar.gz servo-f220a63a0f4d7757c2a5e7c9da1c2063d37bebd6.zip |
Auto merge of #22133 - servo:extern-crate, r=SimonSapin
Use 2018-edition idioms in crates that use that edition
The first commit is almost entirely mechanical, created by running `cargo fix --edition-idioms` and relevant crates. I undid the change of adding an anonymous lifetime parameter in types that have implicit lifetimes parameters, for example replacing `&mut Formatter` with `&mut Formatter<'_>`, because I don’t like it. The remaining changes are, in many places:
* Add `dyn` to trait object types, for example `Rc<gl::Gl>` to `Rc<dyn gl::Gl>`. This change also works in the 2015 edition.
* Remove `extern crate` where is it made unneeded by changes to the import/module system.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22133)
<!-- Reviewable:end -->
Diffstat (limited to 'components/compositing')
-rw-r--r-- | components/compositing/build.rs | 2 | ||||
-rw-r--r-- | components/compositing/compositor.rs | 3 | ||||
-rw-r--r-- | components/compositing/compositor_thread.rs | 5 | ||||
-rw-r--r-- | components/compositing/gl.rs | 4 | ||||
-rw-r--r-- | components/compositing/lib.rs | 22 | ||||
-rw-r--r-- | components/compositing/windowing.rs | 4 |
6 files changed, 7 insertions, 33 deletions
diff --git a/components/compositing/build.rs b/components/compositing/build.rs index 54532276222..9803ce9480d 100644 --- a/components/compositing/build.rs +++ b/components/compositing/build.rs @@ -2,8 +2,6 @@ * 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/. */ -extern crate toml; - use std::env; use std::fs::File; use std::io::{Read, Write}; diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index c3974c7fd01..ee25a835d7e 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -40,7 +40,6 @@ 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}; use webrender_api::{LayoutVector2D, ScrollLocation}; @@ -263,7 +262,7 @@ impl RenderNotifier { } impl webrender_api::RenderNotifier for RenderNotifier { - fn clone(&self) -> Box<webrender_api::RenderNotifier> { + fn clone(&self) -> Box<dyn webrender_api::RenderNotifier> { Box::new(RenderNotifier::new(self.compositor_proxy.clone())) } diff --git a/components/compositing/compositor_thread.rs b/components/compositing/compositor_thread.rs index a897f141fed..76b14d3eb6e 100644 --- a/components/compositing/compositor_thread.rs +++ b/components/compositing/compositor_thread.rs @@ -17,13 +17,12 @@ use script_traits::{AnimationState, ConstellationMsg, EventResult}; use servo_channel::{Receiver, Sender}; use std::fmt::{Debug, Error, Formatter}; use style_traits::viewport::ViewportConstraints; -use webrender; use webrender_api::{self, DeviceIntPoint, DeviceUintSize}; /// Sends messages to the compositor. pub struct CompositorProxy { pub sender: Sender<Msg>, - pub event_loop_waker: Box<EventLoopWaker>, + pub event_loop_waker: Box<dyn EventLoopWaker>, } impl CompositorProxy { @@ -98,7 +97,7 @@ pub enum Msg { /// Runs a closure in the compositor thread. /// It's used to dispatch functions from webrender to the main thread's event loop. /// Required to allow WGL GLContext sharing in Windows. - Dispatch(Box<Fn() + Send>), + Dispatch(Box<dyn Fn() + Send>), /// Indicates to the compositor that it needs to record the time when the frame with /// the given ID (epoch) is painted and report it to the layout thread of the given /// pipeline ID. diff --git a/components/compositing/gl.rs b/components/compositing/gl.rs index 6637ef203ea..59c1225cd91 100644 --- a/components/compositing/gl.rs +++ b/components/compositing/gl.rs @@ -14,7 +14,7 @@ pub struct RenderTargetInfo { } pub fn initialize_png( - gl: &gl::Gl, + gl: &dyn gl::Gl, width: DeviceUintLength, height: DeviceUintLength, ) -> RenderTargetInfo { @@ -80,7 +80,7 @@ pub fn initialize_png( } pub fn draw_img( - gl: &gl::Gl, + gl: &dyn gl::Gl, render_target_info: RenderTargetInfo, width: DeviceUintLength, height: DeviceUintLength, diff --git a/components/compositing/lib.rs b/components/compositing/lib.rs index c631f39275e..d54feac56bb 100644 --- a/components/compositing/lib.rs +++ b/components/compositing/lib.rs @@ -4,30 +4,8 @@ #![deny(unsafe_code)] -extern crate embedder_traits; -extern crate euclid; -extern crate gfx_traits; -#[cfg(feature = "gleam")] -extern crate gleam; -#[cfg(feature = "gleam")] -extern crate image; -extern crate ipc_channel; -extern crate keyboard_types; -extern crate libc; #[macro_use] extern crate log; -extern crate msg; -extern crate net_traits; -extern crate profile_traits; -extern crate script_traits; -extern crate servo_channel; -extern crate servo_config; -extern crate servo_geometry; -extern crate servo_url; -extern crate style_traits; -extern crate time; -extern crate webrender; -extern crate webrender_api; pub use crate::compositor::IOCompositor; pub use crate::compositor::RenderNotifier; diff --git a/components/compositing/windowing.rs b/components/compositing/windowing.rs index 9ff7e919746..087062c3fc2 100644 --- a/components/compositing/windowing.rs +++ b/components/compositing/windowing.rs @@ -132,9 +132,9 @@ pub trait WindowMethods { fn prepare_for_composite(&self) -> bool; /// Return the GL function pointer trait. #[cfg(feature = "gleam")] - fn gl(&self) -> Rc<gl::Gl>; + fn gl(&self) -> Rc<dyn gl::Gl>; /// Returns a thread-safe object to wake up the window's event loop. - fn create_event_loop_waker(&self) -> Box<EventLoopWaker>; + fn create_event_loop_waker(&self) -> Box<dyn EventLoopWaker>; /// Get the coordinates of the native window, the screen and the framebuffer. fn get_coordinates(&self) -> EmbedderCoordinates; /// Set whether the application is currently animating. |