Skip to content

unused_self: respect avoid-breaking-exported-api #9195

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

Closed
Xiretza opened this issue Jul 17, 2022 · 1 comment · Fixed by #9199
Closed

unused_self: respect avoid-breaking-exported-api #9195

Xiretza opened this issue Jul 17, 2022 · 1 comment · Fixed by #9199
Assignees
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages good first issue These issues are a good way to get started with Clippy

Comments

@Xiretza
Copy link
Contributor

Xiretza commented Jul 17, 2022

Description

unused_self currently suggests converting methods to associated functions even for public APIs:

#![deny(clippy::unused_self)]

pub struct Foo;

impl Foo {
    pub fn test(&self) {}
}
error: unused `self` argument
 --> src/main.rs:6:17
  |
6 |     pub fn test(&self) {}
  |                 ^^^^^
  |
note: the lint level is defined here
 --> src/main.rs:1:9
  |
1 | #![deny(clippy::unused_self)]
  |         ^^^^^^^^^^^^^^^^^^^
  = help: consider refactoring to a associated function
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_self

unused_self should instead respect the avoid-breaking-exported-api option like several other lints and only trigger for public APIs if the option is set to false.

Version

rustc 1.62.0 (a8314ef7d 2022-06-27)
binary: rustc
commit-hash: a8314ef7d0ec7b75c336af2c9857bfaf43002bfc
commit-date: 2022-06-27
host: x86_64-unknown-linux-gnu
release: 1.62.0
LLVM version: 14.0.5

Additional Labels

@rustbot label +C-enhancement

@rustbot rustbot added the C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages label Jul 17, 2022
@xFrednet xFrednet added the good first issue These issues are a good way to get started with Clippy label Jul 18, 2022
@Xiretza
Copy link
Contributor Author

Xiretza commented Jul 18, 2022

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages good first issue These issues are a good way to get started with Clippy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants