Fix nightly and Windows-only clippy warnings (#7095)

This commit is contained in:
Bert Belder 2020-08-14 02:15:12 +02:00
parent b21a7b0fd0
commit b308a774e8
No known key found for this signature in database
GPG key ID: 7A77887B2E2ED461
3 changed files with 10 additions and 32 deletions

View file

@ -3203,6 +3203,8 @@ fn set_raw_should_not_panic_on_no_tty() {
}
#[cfg(windows)]
// Clippy suggests to remove the `NoStd` prefix from all variants. I disagree.
#[allow(clippy::enum_variant_names)]
enum WinProcConstraints {
NoStdIn,
NoStdOut,

View file

@ -991,10 +991,7 @@ pub mod tests {
"#,
));
assert_eq!(dispatch_count.load(Ordering::Relaxed), 1);
assert!(match isolate.poll_unpin(cx) {
Poll::Ready(Ok(_)) => true,
_ => false,
});
assert!(matches!(isolate.poll_unpin(cx), Poll::Ready(Ok(_))));
assert_eq!(dispatch_count.load(Ordering::Relaxed), 1);
js_check(isolate.execute(
"check2.js",
@ -1005,17 +1002,11 @@ pub mod tests {
"#,
));
assert_eq!(dispatch_count.load(Ordering::Relaxed), 2);
assert!(match isolate.poll_unpin(cx) {
Poll::Ready(Ok(_)) => true,
_ => false,
});
assert!(matches!(isolate.poll_unpin(cx), Poll::Ready(Ok(_))));
js_check(isolate.execute("check3.js", "assert(nrecv == 2)"));
assert_eq!(dispatch_count.load(Ordering::Relaxed), 2);
// We are idle, so the next poll should be the last.
assert!(match isolate.poll_unpin(cx) {
Poll::Ready(Ok(_)) => true,
_ => false,
});
assert!(matches!(isolate.poll_unpin(cx), Poll::Ready(Ok(_))));
});
}
@ -1037,10 +1028,7 @@ pub mod tests {
assert_eq!(dispatch_count.load(Ordering::Relaxed), 1);
// The above op never finish, but isolate can finish
// because the op is an unreffed async op.
assert!(match isolate.poll_unpin(cx) {
Poll::Ready(Ok(_)) => true,
_ => false,
});
assert!(matches!(isolate.poll_unpin(cx), Poll::Ready(Ok(_))));
})
}
@ -1167,10 +1155,7 @@ pub mod tests {
"#,
));
assert_eq!(dispatch_count.load(Ordering::Relaxed), 1);
assert!(match isolate.poll_unpin(cx) {
Poll::Ready(Ok(_)) => true,
_ => false,
});
assert!(matches!(isolate.poll_unpin(cx), Poll::Ready(Ok(_))));
js_check(isolate.execute("check.js", "assert(asyncRecv == 1);"));
});
}

View file

@ -891,23 +891,14 @@ pub mod tests {
));
// First poll runs `prepare_load` hook.
assert!(match isolate.poll_unpin(cx) {
Poll::Pending => true,
_ => false,
});
assert!(matches!(isolate.poll_unpin(cx), Poll::Pending));
assert_eq!(prepare_load_count.load(Ordering::Relaxed), 1);
// Second poll actually loads modules into the isolate.
assert!(match isolate.poll_unpin(cx) {
Poll::Ready(Ok(_)) => true,
_ => false,
});
assert!(matches!(isolate.poll_unpin(cx), Poll::Ready(Ok(_))));
assert_eq!(resolve_count.load(Ordering::Relaxed), 4);
assert_eq!(load_count.load(Ordering::Relaxed), 2);
assert!(match isolate.poll_unpin(cx) {
Poll::Ready(Ok(_)) => true,
_ => false,
});
assert!(matches!(isolate.poll_unpin(cx), Poll::Ready(Ok(_))));
assert_eq!(resolve_count.load(Ordering::Relaxed), 4);
assert_eq!(load_count.load(Ordering::Relaxed), 2);
})