-
Notifications
You must be signed in to change notification settings - Fork 1.6k
needless_pass_by_ref_mut
false positive in nested async
#11299
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
Comments
Doesn't look like the same issue. |
I see the problem: need recursion for closures. Gonna check tomorrow. |
I opened #11314 to fix this issue. |
Following example is also a false positive: (and looks about the same?) pub async fn foo(n: &mut usize) -> impl '_ + FnMut() {
|| {
*n += 1;
}
} @GuillaumeGomez could you add [something like] this to the test cases in #11314 ? Edit: #11380 |
I'm also experiencing this same false positive.
despite doing |
@MingweiSamuel Thanks! I'll add it. @SpeckyYT Would have been better to come up with a small example showing the issue. ^^' |
@MingweiSamuel Just took a look and your case is a different one. Do you mind opening a new issue and tagging me on it please? |
Sorry for not providing an example. async fn a(b: &mut Vec<bool>) {
b.append(&mut vec![])
}
|
Thanks! I don't know if #11314 is the one who fixed it but in my case I don't have any warning with your code. I tested with |
…_block, r=Centri3 Correctly handle async blocks for NEEDLESS_PASS_BY_REF_MUT Fixes rust-lang/rust-clippy#11299. The problem was that the `async block`s are popping a closure which we didn't go into, making it miss the mutable access to the variables. cc `@Centri3` changelog: none
…_block, r=Centri3 Correctly handle async blocks for NEEDLESS_PASS_BY_REF_MUT Fixes rust-lang#11299. The problem was that the `async block`s are popping a closure which we didn't go into, making it miss the mutable access to the variables. cc `@Centri3` changelog: none
Looks like someone opened #11380 for this |
Summary
needless_pass_by_ref_mut
false positiveI think it's another variant of #11179, sorry if this issue is a duplicate.
Lint Name
needless_pass_by_ref_mut
Reproducer
I tried this code:
I saw this happen:
I expected to see this happen:
No warning
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: