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

@ -33,23 +33,23 @@ pub trait Actor: Any + ActorAsAny {
}
pub trait ActorAsAny {
fn actor_as_any(&self) -> &Any;
fn actor_as_any_mut(&mut self) -> &mut Any;
fn actor_as_any(&self) -> &dyn Any;
fn actor_as_any_mut(&mut self) -> &mut dyn Any;
}
impl<T: Actor> ActorAsAny for T {
fn actor_as_any(&self) -> &Any {
fn actor_as_any(&self) -> &dyn Any {
self
}
fn actor_as_any_mut(&mut self) -> &mut Any {
fn actor_as_any_mut(&mut self) -> &mut dyn Any {
self
}
}
/// A list of known, owned actors.
pub struct ActorRegistry {
actors: HashMap<String, Box<Actor + Send>>,
new_actors: RefCell<Vec<Box<Actor + Send>>>,
actors: HashMap<String, Box<dyn Actor + Send>>,
new_actors: RefCell<Vec<Box<dyn Actor + Send>>>,
old_actors: RefCell<Vec<String>>,
script_actors: RefCell<HashMap<String, String>>,
shareable: Option<Arc<Mutex<ActorRegistry>>>,
@ -131,11 +131,11 @@ impl ActorRegistry {
}
/// Add an actor to the registry of known actors that can receive messages.
pub fn register(&mut self, actor: Box<Actor + Send>) {
pub fn register(&mut self, actor: Box<dyn Actor + Send>) {
self.actors.insert(actor.name(), actor);
}
pub fn register_later(&self, actor: Box<Actor + Send>) {
pub fn register_later(&self, actor: Box<dyn Actor + Send>) {
let mut actors = self.new_actors.borrow_mut();
actors.push(actor);
}

View file

@ -12,20 +12,10 @@
#![allow(non_snake_case)]
#![deny(unsafe_code)]
extern crate devtools_traits;
extern crate headers_core;
extern crate headers_ext;
extern crate http;
extern crate hyper;
extern crate ipc_channel;
#[macro_use]
extern crate log;
extern crate msg;
#[macro_use]
extern crate serde;
extern crate serde_json;
extern crate servo_channel;
extern crate time;
use crate::actor::{Actor, ActorRegistry};
use crate::actors::browsing_context::BrowsingContextActor;