Skip to content

should_implement_trait triggered on private method #2159

@vorner

Description

@vorner

Hello

Today, I created a struct with some public interface. Internally, I want to use it a bit like iterator, so I implemented a private fn next(&mut self) -> Option<T> helper method. This is on purpose to mimic the Iterator trait.

Clippy tells me that I should implement the trait. But that would make the next method effectively public interface, which I don't want.

In that sense, it seems like a false positive to me ‒ should the lint be triggered only on public methods if the trait is public? Or is my use case too odd?

To show the real code, here is the commit:
vorner/corona@cb01227#diff-40d2d23f45cd6212d2b8a20a61048c94R88

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thinggood first issueThese issues are a good way to get started with Clippy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions