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 not_good(x: &RefCell<u32>) -> u32 {
43 let first = baz().await;
46 let b = x.borrow_mut();
50 let third = baz().await;
52 first + second + third
55 #[allow(clippy::manual_async_fn)]
56 fn block_bad(x: &RefCell<u32>) -> impl std::future::Future<Output = u32> + '_ {
58 let b = x.borrow_mut();
64 let m = RefCell::new(100);