Skip to content

Fix false positive in await_holding_* lints #6355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions tests/ui/await_holding_refcell_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,13 @@ async fn also_bad(x: &RefCell<u32>) -> u32 {
first + second + third
}

async fn less_bad(x: &RefCell<u32>) -> u32 {
let first = baz().await;

async fn dropped_in_time(x: &RefCell<u32>) -> u32 {
let b = x.borrow_mut();

let second = baz().await;

let c = *b;
drop(b);

let third = baz().await;

first + second + third
let a = baz().await;
a + c
}

async fn not_good(x: &RefCell<u32>) -> u32 {
Expand Down Expand Up @@ -80,7 +75,7 @@ fn main() {
bad(&rc);
bad_mut(&rc);
also_bad(&rc);
less_bad(&rc);
dropped_in_time(&rc);
not_good(&rc);
block_bad(&rc);
}