From 27912b7a9cc6eead67767172a26a06832b3dbbf2 Mon Sep 17 00:00:00 2001 From: Cecile Tonglet Date: Tue, 25 Jan 2022 10:23:06 +0100 Subject: [PATCH] Remove unnecessary new() functions --- tokio-util/src/net/mod.rs | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/tokio-util/src/net/mod.rs b/tokio-util/src/net/mod.rs index 750fb306450..906017ee91e 100644 --- a/tokio-util/src/net/mod.rs +++ b/tokio-util/src/net/mod.rs @@ -24,7 +24,7 @@ pub trait Listener { where Self: Sized, { - ListenerAcceptFut::new(self) + ListenerAcceptFut { listener: self } } /// Returns the local address that this listener is bound to. @@ -51,15 +51,6 @@ pub struct ListenerAcceptFut<'a, L> { listener: &'a mut L, } -impl<'a, L> ListenerAcceptFut<'a, L> -where - L: Listener, -{ - fn new(listener: &'a mut L) -> Self { - Self { listener } - } -} - impl<'a, L> Future for ListenerAcceptFut<'a, L> where L: Listener, @@ -96,7 +87,7 @@ where where Self: Sized, { - EitherListenerAcceptFut::new(self) + EitherListenerAcceptFut { listener: self } } /// Returns the local address that this listener is bound to. @@ -120,16 +111,6 @@ pub struct EitherListenerAcceptFut<'a, L, R> { listener: &'a mut Either, } -impl<'a, L, R> EitherListenerAcceptFut<'a, L, R> -where - L: Listener, - R: Listener, -{ - fn new(listener: &'a mut Either) -> Self { - Self { listener } - } -} - impl<'a, L, R> Future for EitherListenerAcceptFut<'a, L, R> where L: Listener,