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

WIP Enable clippy::same_name_method lint #1556

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ids1024
Copy link
Member

@ids1024 ids1024 commented Oct 2, 2024

It is confusing and error prone to have a method on a type and a trait implemented by that type with the same name.

This is particularly bad for something like <Window as SpaceElement>::bbox, which actually calls Window::bbox_with_popups. Which is different from Window::box. But these three functions have the same type signature.

It seems good to disallow this lint in general, but it can be allowed where the methods do the same thing.

Not sure how we want to resolve this. Is there a better way to name bbox/geometry to avoid duplication? "Geometry" seems like a problematically overloaded term in general...

I guess it's probably not intentional that xwm::X11Surface has two definitions of alive(), once as self.state.lock().unwrap().alive and once as self.state.lock().unwrap().alive && self.conn.strong_count() != 0?

It is confusing and error prone to have a method on a type and a trait
implemented by that type with the same name.

This is particularly bad for something like `<Window as SpaceElement>::bbox`,
which actually calls `Window::bbox_with_popups`. Which is different from
`Window::box`. But these three functions have the same type signature.

It seems good to disallow this lint in general, but it can be allowed
where the methods do the same thing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant