cargo fix --edition-idioms

This commit is contained in:
Simon Sapin 2018-11-01 21:43:04 +01:00
parent b1fd6237d1
commit 2012be4a8b
203 changed files with 665 additions and 1281 deletions

View file

@ -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;

View file

@ -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> {

View file

@ -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) {

View file

@ -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!()
}

View file

@ -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;

View file

@ -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(),
})

View file

@ -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;