Open
Description
Using 1.59.0-beta.3, the following illustrates the point:
warning: missing `#[must_use]` attribute on a method returning `Self`
--> libp2p-streaming-response/src/v2/behaviour.rs:32:5
|
32 | / pub fn with_request_timeout(self, request_timeout: Duration) -> Self {
33 | | Self {
34 | | request_timeout,
35 | | ..self
36 | | }
37 | | }
| |_____^
|
= note: `#[warn(clippy::return_self_not_must_use)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#return_self_not_must_use
I can see how a method that takes &self
and produces Self
may be misused (although I don’t think that is compelling enough to warrant a default lint), but the above method is not susceptible to programmer mistakes, thanks to Rust’s affine type system. If you deem this worthy of a fix, I may try my hand at it.
Metadata
Metadata
Assignees
Labels
No labels