Skip to content

Commit

Permalink
Remove unnecessary new() functions
Browse files Browse the repository at this point in the history
  • Loading branch information
cecton committed Jan 25, 2022
1 parent b639d98 commit 27912b7
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions tokio-util/src/net/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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,
Expand Down Expand Up @@ -96,7 +87,7 @@ where
where
Self: Sized,
{
EitherListenerAcceptFut::new(self)
EitherListenerAcceptFut { listener: self }
}

/// Returns the local address that this listener is bound to.
Expand All @@ -120,16 +111,6 @@ pub struct EitherListenerAcceptFut<'a, L, R> {
listener: &'a mut Either<L, R>,
}

impl<'a, L, R> EitherListenerAcceptFut<'a, L, R>
where
L: Listener,
R: Listener,
{
fn new(listener: &'a mut Either<L, R>) -> Self {
Self { listener }
}
}

impl<'a, L, R> Future for EitherListenerAcceptFut<'a, L, R>
where
L: Listener,
Expand Down

0 comments on commit 27912b7

Please sign in to comment.