Skip to content

Commit b968738

Browse files
authored
Rollup merge of #77918 - wcampbell0x2a:cleanup-network-tests, r=m-ou-se
Cleanup network tests Some cleanup for network related tests
2 parents 4859786 + 964a5ac commit b968738

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

library/std/src/fs/tests.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,9 @@ pub fn got_symlink_permission(tmpdir: &TempDir) -> bool {
7373
let link = tmpdir.join("some_hopefully_unique_link_name");
7474

7575
match symlink_file(r"nonexisting_target", link) {
76-
Ok(_) => true,
7776
// ERROR_PRIVILEGE_NOT_HELD = 1314
7877
Err(ref err) if err.raw_os_error() == Some(1314) => false,
79-
Err(_) => true,
78+
Ok(_) | Err(_) => true,
8079
}
8180
}
8281

library/std/src/net/udp/tests.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,19 +152,13 @@ fn udp_clone_two_write() {
152152
let (done, rx) = channel();
153153
let tx2 = tx.clone();
154154
let _t = thread::spawn(move || {
155-
match sock3.send_to(&[1], &addr2) {
156-
Ok(..) => {
157-
let _ = tx2.send(());
158-
}
159-
Err(..) => {}
155+
if sock3.send_to(&[1], &addr2).is_ok() {
156+
let _ = tx2.send(());
160157
}
161158
done.send(()).unwrap();
162159
});
163-
match sock1.send_to(&[2], &addr2) {
164-
Ok(..) => {
165-
let _ = tx.send(());
166-
}
167-
Err(..) => {}
160+
if sock1.send_to(&[2], &addr2).is_ok() {
161+
let _ = tx.send(());
168162
}
169163
drop(tx);
170164

0 commit comments

Comments
 (0)