Skip to content

Fulfill the lint expectation even if allowed at the type level #14604

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

Merged

Conversation

samueltardieu
Copy link
Contributor

@samueltardieu samueltardieu commented Apr 13, 2025

clippy::len_without_is_empty can be allowed at the type declaration site, and this will prevent the lint from triggering even though the lint is shown on the len() method definition.

This allows the lint to be expected even though it is allowed at the type declaration site.

changelog: [len_without_is_empty]: the lint can now be #[expect]ed on the len() method even when it is #[allow]ed on the definining type.

Fixes #14597

@rustbot
Copy link
Collaborator

rustbot commented Apr 13, 2025

r? @llogiq

rustbot has assigned @llogiq.
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 Apr 13, 2025
@samueltardieu
Copy link
Contributor Author

r? @Alexendoo

@rustbot rustbot assigned Alexendoo and unassigned llogiq Apr 13, 2025
@samueltardieu samueltardieu force-pushed the fulfill-len-without-is-empty branch from 4b01dbb to 1053eb0 Compare April 13, 2025 19:59
`clippy::len_without_is_empty` can be allowed at the type declaration
site, and this will prevent the lint from triggering even though the
lint is shown on the `len()` method definition.

This allows the lint to be expected even though it is allowed at the
type declaration site.
@samueltardieu samueltardieu force-pushed the fulfill-len-without-is-empty branch from 1053eb0 to 327da45 Compare April 13, 2025 20:04
Copy link
Member

@Alexendoo Alexendoo left a comment

Choose a reason for hiding this comment

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

👍

@Alexendoo Alexendoo added this pull request to the merge queue Apr 13, 2025
Merged via the queue into rust-lang:master with commit 69ade77 Apr 13, 2025
11 checks passed
@samueltardieu samueltardieu deleted the fulfill-len-without-is-empty branch April 14, 2025 06:45
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.

expect(len_without_is_empty) can trigger unfulfilled_lint_expectations when not enabled
4 participants