Skip to content

Commit 0c64789

Browse files
committed
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.
2 parents 5aac93c + 0e9d260 commit 0c64789

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/libstd/sys_common/net.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,8 @@ mod tests {
622622
Ok(lh) => lh,
623623
Err(e) => panic!("couldn't resolve `localhost': {}", e)
624624
};
625-
let _na = lh.map(|sa| *addrs.entry(sa).or_insert(0) += 1).count();
626-
assert!(addrs.values().filter(|&&v| v > 1).count() == 0);
625+
for sa in lh { *addrs.entry(sa).or_insert(0) += 1; };
626+
assert_eq!(addrs.iter().filter(|&(_, &v)| v > 1).collect::<Vec<_>>(), vec![],
627+
"There should be no duplicate localhost entries");
627628
}
628629
}

0 commit comments

Comments
 (0)