This lint should warn users attempting to hold a RefCell's Ref or RefMut guards across an await point.
Advantage
Even in a single-threaded environment, external code can run during awaits. This code may attempt to borrow the same RefCell, causing a panic.
Drawbacks
Holding a borrow may be intentional, although it likely isn't.
Example
async {
let my_cell: RefCell<_> = /* divine it from somewhere */;
let my_borrow = my_cell.borrow();
some_future().await;
println!("The value is {}!", *my_borrow);
}
There is no trivial improvement to this code. Some examples of a fix might be
moving the println! before the await;
wrapping the value in an Rc, cloning it, and dropping the borrow before the await;
What it does
This lint should warn users attempting to hold a RefCell's Ref or RefMut guards across an await point.
Advantage
Even in a single-threaded environment, external code can run during awaits. This code may attempt to borrow the same RefCell, causing a panic.
Drawbacks
Holding a borrow may be intentional, although it likely isn't.
Example
There is no trivial improvement to this code. Some examples of a fix might be