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

Split needless_lifetime '_ suggestions into elidable_lifetime_names #13960

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

Conversation

Alexendoo
Copy link
Member

@Alexendoo Alexendoo commented Jan 7, 2025

Fixes #13514

changelog: Split [needless_lifetime] suggestions that use '_ into a new pedantic lint [elidable_lifetime_names]

@rustbot
Copy link
Collaborator

rustbot commented Jan 7, 2025

r? @xFrednet

rustbot has assigned @xFrednet.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jan 7, 2025
Copy link
Contributor

@samueltardieu samueltardieu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this lint splitting, I'm just not sure about the category to use for the new lint.

/// ```
#[clippy::version = "1.84.0"]
pub ELIDABLE_LIFETIME_NAMES,
pedantic,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR does two things at once: it not only splits the lint, but also moves part of it from complexity to pedantic. Since people would be able to silence the elidable_lifetime_names, shouldn't it stay into complexity?

My rationale is that an unused variable will get flagged if it doesn't start with _, why shouldn't we continue to do the same with unused lifetimes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since a good number of people want to silence it we generally take that as an indicator that it should be moved into pedantic

I don't think it's as severe as unused variables since the lifetimes are still used even though they could be elided

@Alexendoo Alexendoo force-pushed the split-needless-lifetimes branch from 5b9427e to 03ada72 Compare January 13, 2025 15:46
@Alexendoo Alexendoo force-pushed the split-needless-lifetimes branch from 03ada72 to 9d98207 Compare January 19, 2025 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider splitting needless_lifetimes into cases that do and do not require '_
4 participants