2020-12-06 14:01:03 +00:00
|
|
|
#![warn(clippy::all)]
|
|
|
|
#![warn(clippy::redundant_pattern_matching)]
|
2021-04-22 09:31:13 +00:00
|
|
|
#![allow(
|
|
|
|
unused_must_use,
|
|
|
|
clippy::needless_bool,
|
2023-07-02 12:35:19 +00:00
|
|
|
clippy::needless_if,
|
2021-04-22 09:31:13 +00:00
|
|
|
clippy::match_like_matches_macro,
|
2021-10-07 09:21:30 +00:00
|
|
|
clippy::equatable_if_let,
|
2021-04-22 09:31:13 +00:00
|
|
|
clippy::if_same_then_else
|
|
|
|
)]
|
2020-12-06 14:01:03 +00:00
|
|
|
|
|
|
|
use std::task::Poll::{self, Pending, Ready};
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
if let Pending = Pending::<()> {}
|
|
|
|
|
|
|
|
if let Ready(_) = Ready(42) {}
|
|
|
|
|
|
|
|
if let Ready(_) = Ready(42) {
|
|
|
|
foo();
|
|
|
|
} else {
|
|
|
|
bar();
|
|
|
|
}
|
|
|
|
|
2023-12-28 18:33:07 +00:00
|
|
|
// Issue 6459
|
|
|
|
if matches!(Ready(42), Ready(_)) {}
|
|
|
|
|
|
|
|
// Issue 6459
|
|
|
|
if matches!(Pending::<()>, Pending) {}
|
|
|
|
|
2020-12-06 14:01:03 +00:00
|
|
|
while let Ready(_) = Ready(42) {}
|
|
|
|
|
|
|
|
while let Pending = Ready(42) {}
|
|
|
|
|
|
|
|
while let Pending = Pending::<()> {}
|
|
|
|
|
|
|
|
if Pending::<i32>.is_pending() {}
|
|
|
|
|
|
|
|
if Ready(42).is_ready() {}
|
|
|
|
|
|
|
|
match Ready(42) {
|
|
|
|
Ready(_) => true,
|
|
|
|
Pending => false,
|
|
|
|
};
|
|
|
|
|
|
|
|
match Pending::<()> {
|
|
|
|
Ready(_) => false,
|
|
|
|
Pending => true,
|
|
|
|
};
|
|
|
|
|
|
|
|
let _ = match Pending::<()> {
|
|
|
|
Ready(_) => false,
|
|
|
|
Pending => true,
|
|
|
|
};
|
|
|
|
|
|
|
|
let poll = Ready(false);
|
|
|
|
let _ = if let Ready(_) = poll { true } else { false };
|
|
|
|
|
|
|
|
poll_const();
|
|
|
|
|
|
|
|
let _ = if let Ready(_) = gen_poll() {
|
|
|
|
1
|
|
|
|
} else if let Pending = gen_poll() {
|
|
|
|
2
|
|
|
|
} else {
|
|
|
|
3
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
fn gen_poll() -> Poll<()> {
|
|
|
|
Pending
|
|
|
|
}
|
|
|
|
|
|
|
|
fn foo() {}
|
|
|
|
|
|
|
|
fn bar() {}
|
|
|
|
|
|
|
|
const fn poll_const() {
|
|
|
|
if let Ready(_) = Ready(42) {}
|
|
|
|
|
|
|
|
if let Pending = Pending::<()> {}
|
|
|
|
|
|
|
|
while let Ready(_) = Ready(42) {}
|
|
|
|
|
|
|
|
while let Pending = Pending::<()> {}
|
|
|
|
|
|
|
|
match Ready(42) {
|
|
|
|
Ready(_) => true,
|
|
|
|
Pending => false,
|
|
|
|
};
|
|
|
|
|
|
|
|
match Pending::<()> {
|
|
|
|
Ready(_) => false,
|
|
|
|
Pending => true,
|
|
|
|
};
|
|
|
|
}
|