Skip to content

item_name_repetitions: exclude enum variants with identical path components #14619

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
merged 1 commit into from
May 6, 2025

Conversation

aaron-ang
Copy link
Contributor

@aaron-ang aaron-ang commented Apr 15, 2025

fix #13637

As suggested in the PR above, we should not lint enum variants containing matching path names.

changelog: [item_name_repetitions]: exclude enum variants with identical path components

@rustbot
Copy link
Collaborator

rustbot commented Apr 15, 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 15, 2025
@aaron-ang
Copy link
Contributor Author

r? @samueltardieu

@rustbot
Copy link
Collaborator

rustbot commented Apr 22, 2025

samueltardieu is on vacation.

Please choose another assignee.

@aaron-ang
Copy link
Contributor Author

r? clippy

@rustbot rustbot assigned Manishearth and unassigned llogiq May 6, 2025
check_enum_start(cx, item_name, var);
check_enum_end(cx, item_name, var);
}

Self::check_enum_common_affix(cx, item, def);
}

// Exclude enum variants that contain a single item where any component
// of the contained item's path is identical to the variant's name.
fn filter_matching_enum_data<'a>(def: &'a EnumDef<'a>) -> Vec<&'a Variant<'a>> {
Copy link
Member

Choose a reason for hiding this comment

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

issue: I don't think we should prefilter; we should instead perform this check in check_enum_start and check_enum_end after we think we want to lint on it (so we perform this more expensive check later)

Copy link
Contributor Author

@aaron-ang aaron-ang May 6, 2025

Choose a reason for hiding this comment

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

makes sense, I've made changes to reflect this

@aaron-ang aaron-ang force-pushed the enum-encapsulate branch from 088a429 to 9adf1f0 Compare May 6, 2025 03:11
@aaron-ang aaron-ang force-pushed the enum-encapsulate branch from 9adf1f0 to e89cf4d Compare May 6, 2025 03:15
@Manishearth Manishearth added this pull request to the merge queue May 6, 2025
Merged via the queue into rust-lang:master with commit fc811f7 May 6, 2025
11 checks passed
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.

enum_variant_names does not consider encapsulated type
4 participants