remove reliance on lookup_host

This commit is contained in:
David Hotham 2017-09-07 11:06:53 +01:00
parent 37886ce3a2
commit 7704ab36c7
2 changed files with 2 additions and 3 deletions

View File

@ -1,5 +1,5 @@
use std::collections::HashMap; use std::collections::HashMap;
use std::net::{IpAddr, lookup_host}; use std::net::ToSocketAddrs;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::convert::AsRef; use std::convert::AsRef;
use std::fmt; use std::fmt;
@ -344,7 +344,7 @@ impl Config {
/// ``` /// ```
pub fn set_address<A: Into<String>>(&mut self, address: A) -> Result<()> { pub fn set_address<A: Into<String>>(&mut self, address: A) -> Result<()> {
let address = address.into(); let address = address.into();
if address.parse::<IpAddr>().is_err() && lookup_host(&address).is_err() { if (address.as_ref(), 0u16).to_socket_addrs().is_err() {
return Err(self.bad_type("address", "string", "a valid hostname or IP")); return Err(self.bad_type("address", "string", "a valid hostname or IP"));
} }

View File

@ -2,7 +2,6 @@
#![feature(conservative_impl_trait)] #![feature(conservative_impl_trait)]
#![feature(drop_types_in_const)] #![feature(drop_types_in_const)]
#![feature(const_fn)] #![feature(const_fn)]
#![feature(lookup_host)]
#![feature(plugin)] #![feature(plugin)]
#![feature(never_type)] #![feature(never_type)]
#![feature(try_trait)] #![feature(try_trait)]