rust-clippy/tests/ui/waker_clone_wake.fixed

30 lines
436 B
Rust
Raw Normal View History

#[derive(Clone)]
pub struct Custom;
impl Custom {
pub fn wake(self) {}
}
2023-10-25 13:15:29 +00:00
macro_rules! mac {
($cx:ident) => {
$cx.waker()
};
}
pub fn wake(cx: &mut std::task::Context) {
cx.waker().wake_by_ref();
2023-10-25 13:15:29 +00:00
mac!(cx).wake_by_ref();
}
pub fn no_lint(cx: &mut std::task::Context, c: &Custom) {
c.clone().wake();
let w = cx.waker().clone();
w.wake();
cx.waker().clone().wake_by_ref();
}
fn main() {}