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 collection_is_never_used #5654

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

jbencin
Copy link
Contributor

@jbencin jbencin commented Jan 4, 2025

Description

Apply Clippy lint collection_is_never_used. This found a lot of collections, mostly in test code, that were created but never read. These fell into a few different categories:

  • Something which looked like it was intended to be used, but was not. These are possible bugs and should be reviewed by someone familiar with the code!
  • Storing the result of calling a function with a side effect. I left these alone and marked them with #[allow(clippy::collection_is_never_read)]
  • Obvious leftovers from copy/pasted blocks of code, particularly in tests

Note that collection_is_never_used is a "Nursery" lint, meaning it's not considered stable/accurate. It's not in the default set of lints Clippy runs, but still useful for finding unused code

@jbencin jbencin requested a review from a team as a code owner January 4, 2025 05:04
@kantai kantai added the lint Related to linting/clippy/cargo warns label Jan 17, 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.

This mostly looks good to me. I just had some minor comments. It seems like the majority of these are from copy/pastes from one test to another.

stackslib/src/chainstate/nakamoto/coordinator/tests.rs Outdated Show resolved Hide resolved
stackslib/src/net/tests/download/epoch2x.rs Outdated Show resolved Hide resolved
stackslib/src/util_lib/strings.rs Show resolved Hide resolved
testnet/stacks-node/src/tests/nakamoto_integrations.rs Outdated Show resolved Hide resolved
@jbencin jbencin requested a review from obycode January 23, 2025 14:39
@jbencin jbencin requested a review from kantai January 24, 2025 21:03
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!

@obycode
Copy link
Contributor

obycode commented Jan 27, 2025

Make sure integration tests pass on retry.

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.

3 participants