Skip to content

Commit 1cb0565

Browse files
committed
Revert dup monomorphization in Socket::new
Signed-off-by: Jiahao XU <[email protected]>
1 parent 0e0c436 commit 1cb0565

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/port_forwarding.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,10 @@ impl From<Box<Path>> for Socket<'static> {
100100
impl Socket<'_> {
101101
/// Create a new TcpSocket
102102
pub fn new<T: ToSocketAddrs>(addr: &T) -> Result<Socket<'static>, io::Error> {
103-
fn inner(it: &mut dyn Iterator<Item = SocketAddr>) -> Result<Socket<'static>, io::Error> {
104-
it.next()
105-
.ok_or_else(|| {
106-
io::Error::new(io::ErrorKind::Other, "no more socket addresses to try")
107-
})
108-
.map(Socket::TcpSocket)
109-
}
110-
111-
inner(&mut addr.to_socket_addrs()?)
103+
addr.to_socket_addrs()?
104+
.next()
105+
.ok_or_else(|| io::Error::new(io::ErrorKind::Other, "no more socket addresses to try"))
106+
.map(Socket::TcpSocket)
112107
}
113108

114109
#[cfg(feature = "process-mux")]

0 commit comments

Comments
 (0)