Skip to content

fix: remove redundant collect_extra_allowed_attributes call#9628

Closed
ANtutov wants to merge 1 commit intostarkware-libs:mainfrom
ANtutov:fix/duplicate-attr-collection
Closed

fix: remove redundant collect_extra_allowed_attributes call#9628
ANtutov wants to merge 1 commit intostarkware-libs:mainfrom
ANtutov:fix/duplicate-attr-collection

Conversation

@ANtutov
Copy link
Copy Markdown
Contributor

@ANtutov ANtutov commented Feb 9, 2026

Summary

Removed the redundant collect_extra_allowed_attributes call from validate_attributes_flat and use the passed extra_allowed_attributes parameter directly. This eliminates duplicate work while maintaining the same validation behavior.


Type of change

  • Style, wording, formatting, or typo-only change

Why is this change needed?

The validate_attributes_flat function redundantly called collect_extra_allowed_attributes internally, even though the caller validate_attributes already collected these attributes and passed them as the extra_allowed_attributes parameter. This caused:

  1. Double work for top-level items - attributes were collected twice
  2. Unnecessary calls for nested items (trait functions, struct fields, enum variants) which cannot have #[allow(...)] attributes anyway

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@reviewable-StarkWare
Copy link
Copy Markdown

This change is Reviewable

Copy link
Copy Markdown
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

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

@orizi made 1 comment.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @ANtutov).


a discussion (no related file):
The PR assumes nested items can't have #[allow_attr(...)], but removing the local collection prevents nested items from defining their own allowed attributes. This could be a breaking change if any nested items use #[allow_attr(...)].

@orizi
Copy link
Copy Markdown
Collaborator

orizi commented Feb 18, 2026

No response.

Closing.

@orizi orizi closed this Feb 18, 2026
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.

3 participants