chore(lib): add dyn keyword to trait objects (#1820)

Requires Rust 1.27.
This commit is contained in:
Sean McArthur
2019-06-03 13:08:13 -07:00
committed by GitHub
parent e0f5a9c6c5
commit 01c03db7ea
28 changed files with 107 additions and 94 deletions

View File

@@ -184,7 +184,7 @@ impl fmt::Debug for GaiAddrs {
}
#[derive(Clone)]
struct GaiExecutor(Arc<Executor<GaiTask> + Send + Sync>);
struct GaiExecutor(Arc<dyn Executor<GaiTask> + Send + Sync>);
impl Executor<oneshot::Execute<GaiBlocking>> for GaiExecutor {
fn execute(&self, future: oneshot::Execute<GaiBlocking>) -> Result<(), ExecuteError<oneshot::Execute<GaiBlocking>>> {

View File

@@ -27,7 +27,7 @@ pub trait Connect: Send + Sync {
/// The connected IO Stream.
type Transport: AsyncRead + AsyncWrite + Send + 'static;
/// An error occured when trying to connect.
type Error: Into<Box<StdError + Send + Sync>>;
type Error: Into<Box<dyn StdError + Send + Sync>>;
/// A Future that will resolve to the connected Transport.
type Future: Future<Item=(Self::Transport, Connected), Error=Self::Error> + Send;
/// Connect to a destination.
@@ -53,7 +53,7 @@ pub struct Connected {
pub(super) extra: Option<Extra>,
}
pub(super) struct Extra(Box<ExtraInner>);
pub(super) struct Extra(Box<dyn ExtraInner>);
#[derive(Clone, Copy, Debug, PartialEq)]
pub(super) enum Alpn {
@@ -344,7 +344,7 @@ impl fmt::Debug for Extra {
}
trait ExtraInner: Send + Sync {
fn clone_box(&self) -> Box<ExtraInner>;
fn clone_box(&self) -> Box<dyn ExtraInner>;
fn set(&self, res: &mut Response<::Body>);
}
@@ -358,7 +358,7 @@ impl<T> ExtraInner for ExtraEnvelope<T>
where
T: Clone + Send + Sync + 'static
{
fn clone_box(&self) -> Box<ExtraInner> {
fn clone_box(&self) -> Box<dyn ExtraInner> {
Box::new(self.clone())
}
@@ -367,7 +367,7 @@ where
}
}
struct ExtraChain<T>(Box<ExtraInner>, T);
struct ExtraChain<T>(Box<dyn ExtraInner>, T);
impl<T: Clone> Clone for ExtraChain<T> {
fn clone(&self) -> Self {
@@ -379,7 +379,7 @@ impl<T> ExtraInner for ExtraChain<T>
where
T: Clone + Send + Sync + 'static
{
fn clone_box(&self) -> Box<ExtraInner> {
fn clone_box(&self) -> Box<dyn ExtraInner> {
Box::new(self.clone())
}