profile
viewpoint

Ask questionsPin<&mut self> triggers "wrong_self_convention"

<!-- Hi there! Whether you've come to make a suggestion for a new lint, an improvement to an existing lint or to report a bug or a false positive in Clippy, you've come to the right place.

For bug reports and false positives, please include the output of cargo clippy -V in the report.

Thank you for using Clippy!

Write your comment below this line: -->

Clippy doesn't like it when we use Pin over the Self type:

input

pub fn as_mut(self: Pin<&mut Self>) -> Option<&mut Fut::Output>;

output

error: methods called `as_*` usually take self by reference or self by mutable reference; consider choosing a less ambiguous name

  --> src/maybe_done.rs:36:19

   |

36 |     pub fn as_mut(self: Pin<&mut Self>) -> Option<&mut Fut::Output> {

   |                   ^^^^

   |

   = note: `-D clippy::wrong-self-convention` implied by `-D clippy`

   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention

This seems like it might be related to https://github.com/rust-lang/rust-clippy/issues/4037 and https://github.com/rust-lang/rust-clippy/issues/3414. Though it's also possible this may be working exactly as intended, but I'm not sure.

rust-lang/rust-clippy

Answer questions mikerite

The lint should probably be changed.

Example from the standard library using similar naming/signature: https://doc.rust-lang.org/std/option/enum.Option.html#method.as_pin_mut

This is related to issue #4293.

useful!
source:https://uonfu.com/
Github User Rank List