2020-11-17 15:34:39 -06:00
|
|
|
#![warn(clippy::all)]
|
|
|
|
#![warn(clippy::redundant_pattern_matching)]
|
2021-01-03 13:01:01 -06:00
|
|
|
#![allow(
|
|
|
|
unused_must_use,
|
|
|
|
clippy::needless_bool,
|
2023-06-10 06:43:30 -05:00
|
|
|
clippy::needless_if,
|
2021-01-03 13:01:01 -06:00
|
|
|
clippy::match_like_matches_macro,
|
2021-10-04 01:33:40 -05:00
|
|
|
clippy::equatable_if_let,
|
2021-01-03 13:01:01 -06:00
|
|
|
clippy::if_same_then_else
|
|
|
|
)]
|
2020-11-17 15:34:39 -06:00
|
|
|
|
|
|
|
use std::task::Poll::{self, Pending, Ready};
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
if Pending::<()>.is_pending() {}
|
|
|
|
|
|
|
|
if Ready(42).is_ready() {}
|
|
|
|
|
|
|
|
if Ready(42).is_ready() {
|
|
|
|
foo();
|
|
|
|
} else {
|
|
|
|
bar();
|
|
|
|
}
|
|
|
|
|
2023-12-27 11:53:48 -06:00
|
|
|
// Issue 6459
|
|
|
|
if Ready(42).is_ready() {}
|
|
|
|
|
|
|
|
// Issue 6459
|
|
|
|
if Pending::<()>.is_pending() {}
|
|
|
|
|
2020-11-17 15:34:39 -06:00
|
|
|
while Ready(42).is_ready() {}
|
|
|
|
|
|
|
|
while Ready(42).is_pending() {}
|
|
|
|
|
|
|
|
while Pending::<()>.is_pending() {}
|
|
|
|
|
|
|
|
if Pending::<i32>.is_pending() {}
|
|
|
|
|
|
|
|
if Ready(42).is_ready() {}
|
|
|
|
|
|
|
|
Ready(42).is_ready();
|
|
|
|
|
|
|
|
Pending::<()>.is_pending();
|
|
|
|
|
|
|
|
let _ = Pending::<()>.is_pending();
|
|
|
|
|
|
|
|
let poll = Ready(false);
|
2020-11-24 19:01:05 -06:00
|
|
|
let _ = if poll.is_ready() { true } else { false };
|
2020-11-17 15:34:39 -06:00
|
|
|
|
|
|
|
poll_const();
|
|
|
|
|
|
|
|
let _ = if gen_poll().is_ready() {
|
|
|
|
1
|
|
|
|
} else if gen_poll().is_pending() {
|
|
|
|
2
|
|
|
|
} else {
|
|
|
|
3
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
fn gen_poll() -> Poll<()> {
|
|
|
|
Pending
|
|
|
|
}
|
|
|
|
|
|
|
|
fn foo() {}
|
|
|
|
|
|
|
|
fn bar() {}
|
|
|
|
|
|
|
|
const fn poll_const() {
|
|
|
|
if Ready(42).is_ready() {}
|
|
|
|
|
|
|
|
if Pending::<()>.is_pending() {}
|
|
|
|
|
|
|
|
while Ready(42).is_ready() {}
|
|
|
|
|
|
|
|
while Pending::<()>.is_pending() {}
|
|
|
|
|
|
|
|
Ready(42).is_ready();
|
|
|
|
|
|
|
|
Pending::<()>.is_pending();
|
|
|
|
}
|