We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Socket::new
1 parent 0e0c436 commit 1cb0565Copy full SHA for 1cb0565
src/port_forwarding.rs
@@ -100,15 +100,10 @@ impl From<Box<Path>> for Socket<'static> {
100
impl Socket<'_> {
101
/// Create a new TcpSocket
102
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()?)
+ addr.to_socket_addrs()?
+ .next()
+ .ok_or_else(|| io::Error::new(io::ErrorKind::Other, "no more socket addresses to try"))
+ .map(Socket::TcpSocket)
112
}
113
114
#[cfg(feature = "process-mux")]
0 commit comments