about summary refs log tree commit diff
path: root/library/std/src/net/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'library/std/src/net/mod.rs')
-rw-r--r--library/std/src/net/mod.rs21
1 files changed, 0 insertions, 21 deletions
diff --git a/library/std/src/net/mod.rs b/library/std/src/net/mod.rs
index ddd3b68dd2d..40f1a93e39d 100644
--- a/library/std/src/net/mod.rs
+++ b/library/std/src/net/mod.rs
@@ -34,7 +34,6 @@ pub use self::tcp::IntoIncoming;
 pub use self::tcp::{Incoming, TcpListener, TcpStream};
 #[stable(feature = "rust1", since = "1.0.0")]
 pub use self::udp::UdpSocket;
-use crate::io::{self, ErrorKind};
 
 mod ip_addr;
 mod socket_addr;
@@ -67,23 +66,3 @@ pub enum Shutdown {
     #[stable(feature = "rust1", since = "1.0.0")]
     Both,
 }
-
-fn each_addr<A: ToSocketAddrs, F, T>(addr: A, mut f: F) -> io::Result<T>
-where
-    F: FnMut(io::Result<&SocketAddr>) -> io::Result<T>,
-{
-    let addrs = match addr.to_socket_addrs() {
-        Ok(addrs) => addrs,
-        Err(e) => return f(Err(e)),
-    };
-    let mut last_err = None;
-    for addr in addrs {
-        match f(Ok(&addr)) {
-            Ok(l) => return Ok(l),
-            Err(e) => last_err = Some(e),
-        }
-    }
-    Err(last_err.unwrap_or_else(|| {
-        io::const_error!(ErrorKind::InvalidInput, "could not resolve to any addresses")
-    }))
-}