diff options
| author | bors <bors@rust-lang.org> | 2018-09-17 01:36:58 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-09-17 01:36:58 +0000 |
| commit | 0c6478998e2a0c33e46c951bd011ce367d6438ba (patch) | |
| tree | 6d7c8ac076e50b21a6344e832c782ca1d2e2b4d3 /src/libstd | |
| parent | 5aac93c8fb4dfe16a9690b41c1b9c040608677cb (diff) | |
| parent | 0e9d260e0a53f9d92f09d0276d22b874aee98259 (diff) | |
| download | rust-0c6478998e2a0c33e46c951bd011ce367d6438ba.tar.gz rust-0c6478998e2a0c33e46c951bd011ce367d6438ba.zip | |
Auto merge of #54247 - Munksgaard:better-error-message-in-no_lookup_host_duplicates, r=alexcrichton
Improve output if no_lookup_host_duplicates test fails If the test fails, output the offending addresses and a helpful error message. Also slightly improve legibility of the preceding line that puts the addresses into a HashMap.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/sys_common/net.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libstd/sys_common/net.rs b/src/libstd/sys_common/net.rs index b841afe1a51..d09a233ed89 100644 --- a/src/libstd/sys_common/net.rs +++ b/src/libstd/sys_common/net.rs @@ -622,7 +622,8 @@ mod tests { Ok(lh) => lh, Err(e) => panic!("couldn't resolve `localhost': {}", e) }; - let _na = lh.map(|sa| *addrs.entry(sa).or_insert(0) += 1).count(); - assert!(addrs.values().filter(|&&v| v > 1).count() == 0); + for sa in lh { *addrs.entry(sa).or_insert(0) += 1; }; + assert_eq!(addrs.iter().filter(|&(_, &v)| v > 1).collect::<Vec<_>>(), vec![], + "There should be no duplicate localhost entries"); } } |
