]> git.proxmox.com Git - rustc.git/blobdiff - src/libstd/net/mod.rs
Imported Upstream version 1.9.0+dfsg1
[rustc.git] / src / libstd / net / mod.rs
index d263bf38495c14dfa161720142f95fad3e7c6e1a..45070460282710f84e0de8fcd37e179c573f8421 100644 (file)
@@ -74,7 +74,7 @@ fn each_addr<A: ToSocketAddrs, F, T>(addr: A, mut f: F) -> io::Result<T>
     where F: FnMut(&SocketAddr) -> io::Result<T>
 {
     let mut last_err = None;
-    for addr in try!(addr.to_socket_addrs()) {
+    for addr in addr.to_socket_addrs()? {
         match f(&addr) {
             Ok(l) => return Ok(l),
             Err(e) => last_err = Some(e),
@@ -128,33 +128,3 @@ impl Iterator for LookupHost {
 pub fn lookup_host(host: &str) -> io::Result<LookupHost> {
     net_imp::lookup_host(host).map(LookupHost)
 }
-
-/// Resolve the given address to a hostname.
-///
-/// This function may perform a DNS query to resolve `addr` and may also inspect
-/// system configuration to resolve the specified address. If the address
-/// cannot be resolved, it is returned in string format.
-///
-/// # Examples
-///
-/// ```no_run
-/// #![feature(lookup_addr)]
-/// #![feature(ip_addr)]
-///
-/// use std::net::{self, Ipv4Addr, IpAddr};
-///
-/// let ip_addr = "8.8.8.8";
-/// let addr: Ipv4Addr = ip_addr.parse().unwrap();
-/// let hostname = net::lookup_addr(&IpAddr::V4(addr)).unwrap();
-///
-/// println!("{} --> {}", ip_addr, hostname);
-/// // Output: 8.8.8.8 --> google-public-dns-a.google.com
-/// ```
-#[unstable(feature = "lookup_addr", reason = "recent addition",
-           issue = "27705")]
-#[rustc_deprecated(reason = "ipaddr type is being deprecated",
-                   since = "1.6.0")]
-#[allow(deprecated)]
-pub fn lookup_addr(addr: &IpAddr) -> io::Result<String> {
-    net_imp::lookup_addr(addr)
-}