Skip to content

Clear the clippy backlog, and what it was hiding #281

Closed

Description

@SDL-A1

Migrated from SergioDemianLerner/rustock#281 (pull request by @SDL-A1, 2026-10-07).
Merged: yes. The commits are already in this repository's history.
Original: SergioDemianLerner/rustock#281

Clippy had never run on this workspace. Nothing builds, tests or lints on push -- .github/workflows holds one file and it only runs cargo-deny.

The backlog was 189 warnings across 153 sites. The warnings were not the point; what they were hiding was.

What was actually wrong

A test that had never run. test_rsk_message_rlp_transactions had no #[test] attribute. Its own doc says it exists because the round-trip test cannot catch an encoder/decoder mistake where both sides are wrong in the same way -- so that guarantee was unguarded. It passes now that it executes. Its sibling ..._empty kept its attribute, so an edit appears to have dropped one.

Duplicated attributes. #[test] twice on transactions_decode_keeps_each_transaction_whole; #[cfg(test)] twice on pruner's test module.

Three doc comments damaged by pasted section headers -- content loss, not formatting:

file damage
bridge/peg.rs:6364 cut off mid-sentence: "classifies as P2SHMULTISIG with the"
storage/trie_store.rs:14 the struct's doc fused with an unrelated one about read threads
storage/lib.rs:1765 "Returns a reference to the underlying RocksDB instance" documenting nothing

Surviving words are kept as comments so they stop attaching to the wrong item. The lost text is not invented -- see the filed issue.

Deliberately allowed, each with its reason in place

  • too_many_arguments, type_complexity as workspace policy. The functions tripping the first are consensus entry points whose arguments mirror rskj's; bundling them into structs to satisfy a threshold of 7 would obscure that correspondence and risk reordering a parameter, for no behavioural gain.
  • peg.rs -- two hardfork branches that coincide today but encode distinct rskj rules. Collapsing them would hide that they are separate rules, which is what a future divergence would look like.
  • release_tx.rs -- the repeated push of one placeholder byte is the bitcoinj format: one OP_0 per empty signature slot.
  • btc_block_cache.rs -- a const-evaluated footprint assertion, now written as const _: () = assert!(...).
  • orchid_converter.rs -- guarded unwraps; satisfying the lint means restructuring consensus trie conversion, since both bindings are reused below.
  • The ParentMismatch arm that Detect and repair a canonical index that does not link to itself #263 made unreachable. The allow keeps both the arm and the question visible rather than deleting the evidence -- see ParentMismatch is matched twice: #263 silently shadowed the handler #220 added #280.

Dead code is marked, not deleted

ONE_SHOT and CONFIGURABLE are used, but only from #[cfg(test)], so they are dead in a release build. Six others have lost their callers outright. lookup_receipt is real V1/V2 receipt-lookup logic rather than test scaffolding, which makes it the one worth a decision. Nothing was removed on my judgement.

The finding with no code here

cargo clippy --fix removed a mut that only the smtp build needs -- the sinks.push it guards sits behind #[cfg(feature = "smtp")]. Default builds compiled and all 2,046 tests passed, while --features smtp would not compile at all. That is the configuration the production node runs.

The mut is restored here with a cfg_attr so a future --fix cannot repeat it. The CI that would catch the whole class is proposed in a separate issue, because the token available to me cannot push .github/workflows.

Verification

cargo clippy --workspace --all-targets -- -D warnings   exit 0
cargo test --workspace                                  2,046 passed, 0 failed
cargo test -p rustock-cli --features smtp                  27 passed, 0 failed
cargo check --workspace / --features smtp               0 errors

Every auto-applied --fix change was reviewed before committing. supply.rs (+162/-162) and health.rs (+88/-88) are pure relocations above mod tests, verified by comparing the added and removed line sets.

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions