Auto merge of #17619 - clarcharr:master, r=SimonSapin

Update parse-hosts.

The `parse-hosts` crate was recently updated so that it doesn't use any unstable features.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [X] These changes do not require tests because tests were already implemented.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17619)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-07-06 23:34:13 -07:00 committed by GitHub
commit eec51cdd57
3 changed files with 58 additions and 26 deletions

View file

@ -28,7 +28,7 @@ mime_guess = "1.8.0"
msg = {path = "../msg"}
net_traits = {path = "../net_traits"}
openssl = "0.9"
parse-hosts = "0.3.0"
parse-hosts = "0.4.0"
profile_traits = {path = "../profile_traits"}
serde = "1.0"
serde_json = "1.0"

View file

@ -41,19 +41,10 @@ pub fn replace_host_table(table: HashMap<String, IpAddr>) {
}
pub fn parse_hostsfile(hostsfile_content: &str) -> HashMap<String, IpAddr> {
let mut host_table = HashMap::new();
for line in HostsFile::read_buffered(hostsfile_content.as_bytes()).lines() {
if let Ok(ref line) = line {
for host in line.hosts() {
if let Some(ip) = line.ip() {
host_table.insert(host.to_owned(), ip);
}
}
}
}
host_table
HostsFile::read_buffered(hostsfile_content.as_bytes())
.pairs()
.filter_map(Result::ok)
.collect()
}
pub fn replace_host(host: &str) -> Cow<str> {