False positive for await_holding_refcell_ref
: RefMut for keeping the awaited future alive
#6671
Labels
C-bug
Category: Clippy is not doing the correct thing
E-medium
Call for participation: Medium difficulty level problem and requires some initial experience.
I-false-positive
Issue: The lint was triggered on code it shouldn't have
Lint name: await_holding_refcell_ref
I tried this code:
(For more context, see the complete code.)
This might seem a bit of a contrived example, but it's actually the only way I found to use
async fn
inside a Rust struct exported to JavaScript with wasm-bindgen. 🤷 (Better suggestions are welcome though!)I expected to see this happen: No error since the
RefMut
is necessary to keep theinner.write(chunk)
future alive.Instead, this happened: Causes a warning.
Meta
cargo clippy -V
: clippy 0.0.212 (e1884a8e 2020-12-29)rustc -Vv
:I noticed that this particular lint was already downgraded in #6354 for Rust 1.50 (currently in beta). I can confirm that the warning does not show up when using Rust beta or nightly with the default settings. Since it only shows up in Rust 1.49, I worked around it on my end by disabling this lint.
Still, I opened this issue since I think this might be an interesting false positive. Feel free to close if you disagree, no hard feelings. 🙂
The text was updated successfully, but these errors were encountered: