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 redundant_clone #5713

Merged
merged 9 commits into from
Jan 23, 2025

Conversation

jbencin
Copy link
Contributor

@jbencin jbencin commented Jan 15, 2025

Description

Apply Clippy lint redundant_clone. Finds unnecessary calls to .clone(), .to_string(), .to_owned(), etc. This is a nursery lint, and there are still a lot of false positives if you run it, but I think I got all the instances I could

@jbencin jbencin requested review from a team as code owners January 15, 2025 22:15
@jferrant
Copy link
Collaborator

I think there are some issues in the test cache.

@kantai kantai added the lint Related to linting/clippy/cargo warns label Jan 17, 2025
@jbencin
Copy link
Contributor Author

jbencin commented Jan 17, 2025

Fixed CI build failures (due to code gated by --feature=monitoring_prom). I've tested with:

cargo build --all-targets --all-features

To be sure that there's no more hidden failures in code gated by feature flags

jferrant
jferrant previously approved these changes Jan 22, 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.

Wow, that's a lot of unnecessary clones! I'm curious if this will have any performance impact. I noticed one place that I think could be improved and will approve after the merge conflict is resolved and tests still pass.

@jbencin
Copy link
Contributor Author

jbencin commented Jan 23, 2025

I'm curious if this will have any performance impact

Almost all of these are in test code, so node operators shouldn't really see any change, but we might notice cargo test running a bit faster and using less memory

Keep in mind manually optimizing test code has a much larger performance impact because it's built with -o0, so you can be confident that the compiler wasn't optimizing away any of these unnecessary allocations

@jbencin jbencin requested review from obycode and jferrant January 23, 2025 18:08
obycode
obycode previously approved these changes Jan 23, 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.

Approved assuming tests pass

jferrant
jferrant previously approved these changes Jan 23, 2025
@jbencin jbencin dismissed stale reviews from jferrant and obycode via a0e2ae1 January 23, 2025 21:04
@jbencin jbencin requested review from jferrant and obycode January 23, 2025 21:04
@jbencin jbencin enabled auto-merge January 23, 2025 21:21
@jbencin jbencin added this pull request to the merge queue Jan 23, 2025
Merged via the queue into stacks-network:develop with commit a2ef22e Jan 23, 2025
1 check passed
@jbencin jbencin deleted the chore/clippy-redundant-clone branch January 23, 2025 22:23
@blockstack-devops
Copy link
Contributor

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@stacks-network stacks-network locked as resolved and limited conversation to collaborators Jan 31, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lint Related to linting/clippy/cargo warns locked
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants