Skip to content
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

wrong_self_convention for complex input types #7219

Closed
Manishearth opened this issue May 13, 2021 · 1 comment · Fixed by #7222
Closed

wrong_self_convention for complex input types #7219

Manishearth opened this issue May 13, 2021 · 1 comment · Fixed by #7222
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have

Comments

@Manishearth
Copy link
Member

Lint name:wrong_self_convention

I tried this code:

trait Foo {
    fn as_byte_slice(slice: &[Self]) -> &[u8];
}

I expected to see this happen: No lint

Instead, this happened:

warning: methods called `as_*` usually take self by reference or self by mutable reference; consider choosing a less ambiguous name
  --> utils/zerovec/src/ule/mod.rs:45:29
   |
45 |     fn as_byte_slice(slice: &[Self]) -> &[u8];
   |                             ^^^^^^^
   |
   = note: `#[warn(clippy::wrong_self_convention)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention

We should probably allow this when the input is any reference type that involves Self.

Meta

  • cargo clippy -V: clippy 0.1.51 (2fd73fa 2021-03-23)
  • rustc -Vv:

rustc 1.51.0 (2fd73fabe 2021-03-23)
binary: rustc
commit-hash: 2fd73fabe469357a12c2c974c140f67e7cdd76d0
commit-date: 2021-03-23
host: x86_64-unknown-linux-gnu
release: 1.51.0
LLVM version: 11.0.1

@Manishearth Manishearth added C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have labels May 13, 2021
@ThibsG
Copy link
Contributor

ThibsG commented May 13, 2021

same as #7179

@bors bors closed this as completed in 58359b2 May 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants