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

chore: Apply Clippy lint needless_collect #5697

Merged
merged 3 commits into from
Jan 22, 2025

Conversation

jbencin
Copy link
Contributor

@jbencin jbencin commented Jan 14, 2025

Description

Apply Clippy lint needless_collect. This finds places where iterators can be used directly, without having to call collect() and trigger a heap allocation

@jbencin jbencin requested a review from a team as a code owner January 14, 2025 19:49
@jbencin jbencin requested review from jferrant, jcnelson and obycode and removed request for a team January 14, 2025 19:50
obycode
obycode previously approved these changes Jan 14, 2025
Copy link
Contributor

@obycode obycode left a comment

Choose a reason for hiding this comment

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

LGTM

jferrant
jferrant previously approved these changes Jan 14, 2025
@jbencin jbencin enabled auto-merge January 15, 2025 14:57
@jbencin jbencin dismissed stale reviews from jferrant and obycode via cdab6fd January 16, 2025 15:49
@jbencin
Copy link
Contributor Author

jbencin commented Jan 16, 2025

Fixed unit tests by adding missing parenthesis. I'm surprised Rust didn't complain about this. Changed:

if !event_ids.count() == 0 && !other_event_ids.count() == 0

to

if !(event_ids.count() == 0) && !(other_event_ids.count() == 0)

@jbencin jbencin requested review from jferrant and obycode January 16, 2025 16:00
@kantai kantai added the lint Related to linting/clippy/cargo warns label Jan 17, 2025
@jbencin jbencin added this pull request to the merge queue Jan 22, 2025
@jferrant
Copy link
Collaborator

Fixed unit tests by adding missing parenthesis. I'm surprised Rust didn't complain about this. Changed:

if !event_ids.count() == 0 && !other_event_ids.count() == 0

to

if !(event_ids.count() == 0) && !(other_event_ids.count() == 0)

Don't need to change it. But couldn't you just do event_ids.count() != 0 and other_event_ids.count() != 0?

@jbencin
Copy link
Contributor Author

jbencin commented Jan 22, 2025

But couldn't you just do event_ids.count() != 0 and other_event_ids.count() != 0?

I suppose I could have. Maybe Clippy will fix this in a future PR

Merged via the queue into stacks-network:develop with commit e0d3f3c Jan 22, 2025
170 of 173 checks passed
@jbencin jbencin deleted the chore/clippy-needless-collect branch January 22, 2025 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lint Related to linting/clippy/cargo warns
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants