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

disallowed_methods on trait impls #8581

Open
Jarcho opened this issue Mar 24, 2022 · 3 comments · May be fixed by #12194
Open

disallowed_methods on trait impls #8581

Jarcho opened this issue Mar 24, 2022 · 3 comments · May be fixed by #12194
Assignees
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages E-medium Call for participation: Medium difficulty level problem and requires some initial experience.

Comments

@Jarcho
Copy link
Contributor

Jarcho commented Mar 24, 2022

Description

It should be possible to to specify a specific impl of a trait method (e.g. <alloc::vec::Vec as core::iter::IntoIterator>::into_iter) to be disallowed, rather than having to disallow the trait method for all impls. Two things will need to be done to fix this:

  • clippy.toml syntax will need to be extended.
  • The DefId for the trait method will need to be resolved to it's impl's DefId, if possible (generic code will need something more creative here as it could be calling <T as IntoIterator>::into_iter).

@rustbot label +E-medium
@rustbot label +C-enhancement

@rustbot rustbot added E-medium Call for participation: Medium difficulty level problem and requires some initial experience. C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages labels Mar 24, 2022
@DevAccentor
Copy link
Contributor

@rustbot claim

@safinaskar
Copy link

I agree this would be a good feature. There are many ways to copy a string (a.to_owned(), a.clone(), a.to_string()). This lint will allow us to enforce particular way

@Emilgardis
Copy link

Is this still being worked on? @DevAccentor

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 E-medium Call for participation: Medium difficulty level problem and requires some initial experience.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants