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

perf: remove unnecessary calls to 'to_list' #737

Merged
merged 1 commit into from
Jan 29, 2024
Merged

perf: remove unnecessary calls to 'to_list' #737

merged 1 commit into from
Jan 29, 2024

Conversation

mattem
Copy link
Contributor

@mattem mattem commented Jan 28, 2024

Removes the unnecessary calls to to_list to retrieve the single file, when the attr is marked as allow_single_file, the file object can be obtained via ctx.file without the need to flatten the files depset.


Type of change

  • Bug fix (change which fixes an issue)
  • Performance (a code change that improves performance)

For changes visible to end-users

  • Suggested release notes are provided below:

Access toolchain bin via ctx.file to remove the need to flatten the files depset.

Test plan

  • Covered by existing test cases

Copy link
Collaborator

@alexeagle alexeagle left a comment

Choose a reason for hiding this comment

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

nice, how did you find it? Curious if there's something repeatable that belongs in a buildifier lint

@mattem
Copy link
Contributor Author

mattem commented Jan 29, 2024

Was using these as the basis for getting the toolchains working in rules_py and noticed it.

@mattem mattem merged commit 59cc705 into main Jan 29, 2024
70 checks passed
@mattem mattem deleted the no_need_to_list branch January 29, 2024 17:43
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.

2 participants