Skip to content

F401 sort bindings before adding to __all__#11648

Merged
charliermarsh merged 2 commits intomainfrom
ruff.f401.nondet2
May 31, 2024
Merged

F401 sort bindings before adding to __all__#11648
charliermarsh merged 2 commits intomainfrom
ruff.f401.nondet2

Conversation

@plredmond
Copy link
Copy Markdown
Contributor

Sort the binding IDs before passing them to the add-to-__all__ function to address #11619.

@plredmond
Copy link
Copy Markdown
Contributor Author

I ended up sorting the slice rather than the result of the iter/map because that saves a copy. I made the function argument &mut because I figure it's only used in this module. Might be controversial.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 31, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

checker,
import_statement,
&to_reexport.iter().map(|(b, _)| b).collect::<Vec<_>>(),
&mut to_reexport.iter().map(|(b, _)| b).collect::<Vec<_>>(),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe we should just pass in the Vec here, so the ownership is clearer? Then it can be mut imports: Vec<&ImportBinding> and callers don't need to worry about the mutation.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tweaking this quickly so I can include in the release.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok! Thanks for explaining

@charliermarsh charliermarsh added the bug Something isn't working label May 31, 2024
@charliermarsh charliermarsh enabled auto-merge (squash) May 31, 2024 20:25
@charliermarsh charliermarsh merged commit e914bc3 into main May 31, 2024
@charliermarsh charliermarsh deleted the ruff.f401.nondet2 branch May 31, 2024 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants