2 #![warn(clippy::await_holding_refcell_ref)]
4 use std::cell::RefCell;
6 async fn bad(x: &RefCell<u32>) -> u32 {
11 async fn bad_mut(x: &RefCell<u32>) -> u32 {
12 let b = x.borrow_mut();
16 async fn good(x: &RefCell<u32>) -> u32 {
18 let b = x.borrow_mut();
22 let b = x.borrow_mut();
26 async fn baz() -> u32 {
30 async fn also_bad(x: &RefCell<u32>) -> u32 {
31 let first = baz().await;
33 let b = x.borrow_mut();
35 let second = baz().await;
37 let third = baz().await;
39 first + second + third
42 async fn less_bad(x: &RefCell<u32>) -> u32 {
43 let first = baz().await;
45 let b = x.borrow_mut();
47 let second = baz().await;
51 let third = baz().await;
53 first + second + third
56 async fn not_good(x: &RefCell<u32>) -> u32 {
57 let first = baz().await;
60 let b = x.borrow_mut();
64 let third = baz().await;
66 first + second + third
69 #[allow(clippy::manual_async_fn)]
70 fn block_bad(x: &RefCell<u32>) -> impl std::future::Future<Output = u32> + '_ {
72 let b = x.borrow_mut();
78 let rc = RefCell::new(100);