aboutsummaryrefslogtreecommitdiffstats
path: root/ports
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2018-11-01 21:43:04 +0100
committerSimon Sapin <simon.sapin@exyr.org>2018-11-08 09:28:00 +0100
commit2012be4a8bd97f2fd69f986c8fffb1af1eec21dc (patch)
treec9f1ef91146253f72987cb1436866523880965e0 /ports
parentb1fd6237d1304f3d57abdafd3e6e738c1ece9f83 (diff)
downloadservo-2012be4a8bd97f2fd69f986c8fffb1af1eec21dc.tar.gz
servo-2012be4a8bd97f2fd69f986c8fffb1af1eec21dc.zip
`cargo fix --edition-idioms`
Diffstat (limited to 'ports')
-rw-r--r--ports/libsimpleservo/build.rs3
-rw-r--r--ports/libsimpleservo/src/api.rs20
-rw-r--r--ports/libsimpleservo/src/capi.rs4
-rw-r--r--ports/libsimpleservo/src/gl_glue.rs2
-rw-r--r--ports/libsimpleservo/src/lib.rs12
-rw-r--r--ports/servo/glutin_app/window.rs8
-rw-r--r--ports/servo/non_android_main.rs28
7 files changed, 19 insertions, 58 deletions
diff --git a/ports/libsimpleservo/build.rs b/ports/libsimpleservo/build.rs
index 0ba96d6b7a8..116a24b665a 100644
--- a/ports/libsimpleservo/build.rs
+++ b/ports/libsimpleservo/build.rs
@@ -2,9 +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 cc;
-extern crate gl_generator;
-
use gl_generator::{Api, Fallbacks, Profile, Registry};
use std::env;
use std::fs::File;
diff --git a/ports/libsimpleservo/src/api.rs b/ports/libsimpleservo/src/api.rs
index 1c374531612..4e6a168a97d 100644
--- a/ports/libsimpleservo/src/api.rs
+++ b/ports/libsimpleservo/src/api.rs
@@ -106,10 +106,10 @@ pub fn servo_version() -> String {
/// In the future, this will be done in multiple steps.
pub fn init(
init_opts: InitOptions,
- gl: Rc<gl::Gl>,
- waker: Box<EventLoopWaker>,
- readfile: Box<ReadFileTrait + Send + Sync>,
- callbacks: Box<HostTrait>,
+ gl: Rc<dyn gl::Gl>,
+ waker: Box<dyn EventLoopWaker>,
+ readfile: Box<dyn ReadFileTrait + Send + Sync>,
+ callbacks: Box<dyn HostTrait>,
) -> Result<(), &'static str> {
resources::set(Box::new(ResourceReader(readfile)));
@@ -444,9 +444,9 @@ impl ServoGlue {
}
struct ServoCallbacks {
- waker: Box<EventLoopWaker>,
- gl: Rc<gl::Gl>,
- host_callbacks: Box<HostTrait>,
+ waker: Box<dyn EventLoopWaker>,
+ gl: Rc<dyn gl::Gl>,
+ host_callbacks: Box<dyn HostTrait>,
width: Cell<u32>,
height: Cell<u32>,
density: f32,
@@ -464,12 +464,12 @@ impl WindowMethods for ServoCallbacks {
self.host_callbacks.flush();
}
- fn create_event_loop_waker(&self) -> Box<EventLoopWaker> {
+ fn create_event_loop_waker(&self) -> Box<dyn EventLoopWaker> {
debug!("WindowMethods::create_event_loop_waker");
self.waker.clone()
}
- fn gl(&self) -> Rc<gl::Gl> {
+ fn gl(&self) -> Rc<dyn gl::Gl> {
debug!("WindowMethods::gl");
self.gl.clone()
}
@@ -493,7 +493,7 @@ impl WindowMethods for ServoCallbacks {
}
}
-struct ResourceReader(Box<ReadFileTrait + Send + Sync>);
+struct ResourceReader(Box<dyn ReadFileTrait + Send + Sync>);
impl resources::ResourceReaderMethods for ResourceReader {
fn read(&self, file: Resource) -> Vec<u8> {
diff --git a/ports/libsimpleservo/src/capi.rs b/ports/libsimpleservo/src/capi.rs
index bcd1d247854..c71a45a08b2 100644
--- a/ports/libsimpleservo/src/capi.rs
+++ b/ports/libsimpleservo/src/capi.rs
@@ -64,7 +64,7 @@ pub extern "C" fn servo_version() -> *const c_char {
fn init(
opts: CInitOptions,
- gl: Rc<gl::Gl>,
+ gl: Rc<dyn gl::Gl>,
wakeup: extern "C" fn(),
readfile: extern "C" fn(*const c_char) -> *const c_char,
callbacks: CHostCallbacks,
@@ -238,7 +238,7 @@ impl WakeupCallback {
}
impl EventLoopWaker for WakeupCallback {
- fn clone(&self) -> Box<EventLoopWaker + Send> {
+ fn clone(&self) -> Box<dyn EventLoopWaker + Send> {
Box::new(WakeupCallback(self.0))
}
fn wake(&self) {
diff --git a/ports/libsimpleservo/src/gl_glue.rs b/ports/libsimpleservo/src/gl_glue.rs
index 3d8903a4e10..f819105ed4f 100644
--- a/ports/libsimpleservo/src/gl_glue.rs
+++ b/ports/libsimpleservo/src/gl_glue.rs
@@ -89,7 +89,7 @@ pub mod egl {
pub mod gl {
use servo::gl::Gl;
use std::rc::Rc;
- pub fn init() -> Result<Rc<Gl>, &'static str> {
+ pub fn init() -> Result<Rc<dyn Gl>, &'static str> {
// FIXME: Add an OpenGL version
unimplemented!()
}
diff --git a/ports/libsimpleservo/src/lib.rs b/ports/libsimpleservo/src/lib.rs
index 6898f542a8c..cbe24f77c9f 100644
--- a/ports/libsimpleservo/src/lib.rs
+++ b/ports/libsimpleservo/src/lib.rs
@@ -2,20 +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/. */
-#[cfg(target_os = "android")]
-extern crate android_injected_glue;
-#[cfg(target_os = "android")]
-extern crate android_logger;
-#[cfg(target_os = "android")]
-extern crate jni;
-#[cfg(any(target_os = "android", target_os = "windows"))]
-extern crate libc;
#[macro_use]
extern crate log;
-extern crate serde_json;
-extern crate servo;
-#[cfg(target_os = "windows")]
-extern crate winapi;
mod api;
mod gl_glue;
diff --git a/ports/servo/glutin_app/window.rs b/ports/servo/glutin_app/window.rs
index 7f962ca9ce3..655063d37eb 100644
--- a/ports/servo/glutin_app/window.rs
+++ b/ports/servo/glutin_app/window.rs
@@ -153,7 +153,7 @@ pub struct Window {
last_pressed: Cell<Option<KeyboardEvent>>,
animation_state: Cell<AnimationState>,
fullscreen: Cell<bool>,
- gl: Rc<gl::Gl>,
+ gl: Rc<dyn gl::Gl>,
suspended: Cell<bool>,
}
@@ -675,7 +675,7 @@ impl Window {
}
impl WindowMethods for Window {
- fn gl(&self) -> Rc<gl::Gl> {
+ fn gl(&self) -> Rc<dyn gl::Gl> {
self.gl.clone()
}
@@ -738,7 +738,7 @@ impl WindowMethods for Window {
}
}
- fn create_event_loop_waker(&self) -> Box<EventLoopWaker> {
+ fn create_event_loop_waker(&self) -> Box<dyn EventLoopWaker> {
struct GlutinEventLoopWaker {
proxy: Option<Arc<winit::EventsLoopProxy>>,
}
@@ -762,7 +762,7 @@ impl WindowMethods for Window {
}
}
}
- fn clone(&self) -> Box<EventLoopWaker + Send> {
+ fn clone(&self) -> Box<dyn EventLoopWaker + Send> {
Box::new(GlutinEventLoopWaker {
proxy: self.proxy.clone(),
})
diff --git a/ports/servo/non_android_main.rs b/ports/servo/non_android_main.rs
index f246c8d3e4f..80e3f18a72a 100644
--- a/ports/servo/non_android_main.rs
+++ b/ports/servo/non_android_main.rs
@@ -2,32 +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/. */
-extern crate backtrace;
-extern crate euclid;
-#[cfg(target_os = "windows")]
-extern crate gdi32;
-extern crate gleam;
-extern crate glutin;
-extern crate keyboard_types;
-#[macro_use]
-extern crate lazy_static;
-#[cfg(any(target_os = "linux", target_os = "macos"))]
-extern crate osmesa_sys;
-extern crate servo;
-#[cfg(feature = "unstable")]
-#[macro_use]
-extern crate sig;
-#[cfg(any(
- target_os = "macos",
- target_os = "linux",
- target_os = "windows"
-))]
-extern crate tinyfiledialogs;
-#[cfg(target_os = "windows")]
-extern crate user32;
-#[cfg(target_os = "windows")]
-extern crate winapi;
-extern crate winit;
+#[macro_use] extern crate lazy_static;
+#[cfg(feature = "unstable")] #[macro_use] extern crate sig;
// The window backed by glutin
mod glutin_app;