Closed
Description
Summary
As of 1.67
(Pull Request), the #[must_use]
hint is applied to the Output
of a Future
when use on an async fn
. With this change clippy now reports a false positive double-must-use
in the context of async fn
s.
Lint Name
double-must-use
Reproducer
I tried this code:
#[must_use]
pub async fn new_reliable(room_url: impl Into<String>) -> (Self, MessageLoopFuture) {
...
}
I saw this happen:
error: this function has an empty `#[must_use]` attribute, but returns a type already marked as `#[must_use]`
Error: --> matchbox_socket/src/webrtc_socket/socket.rs:139:5
|
139 | pub async fn new_unreliable(room_url: impl Into<String>) -> (Self, MessageLoopFuture) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: either add some descriptive text or remove the attribute
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#double_must_use
= note: `-D clippy::double-must-use` implied by `-D warnings`
I expected to see this happen:
No warning
Version
rustc 1.68.0 (2c8cc3432 2023-03-06)
binary: rustc
commit-hash: 2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74
commit-date: 2023-03-06
host: x86_64-unknown-linux-gnu
release: 1.68.0
LLVM version: 15.0.6
Additional Labels
No response