Fix or suppress more clippy lints#709
Merged
Merged
Conversation
7d56d38 to
c0762ba
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR primarily addresses Clippy lint warnings across the workspace by tightening imports, making intent explicit (e.g., Vec::new(), HashSet::new()), and adding targeted #[expect(..., reason = "...")] annotations. The only substantive logic change is updating the ChiaPoS ported test helper to use unsigned arithmetic for modular matching.
Changes:
- Replace a number of
Default::default()/broad patterns with more explicit constructors, imports, and unit-pattern matches to satisfy Clippy. - Refine a few internal APIs/types to reduce lint noise (e.g., boxing
IdentifyEvent, switching some&selfmethods toselfforCopytypes, and saferMaybeUninithandling). - Rewrite
check_match()in ChiaPoS table tests to use unsigned arithmetic and clearer modular equivalence.
Reviewed changes
Copilot reviewed 85 out of 85 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/shared/ab-proof-of-time/src/aes/x86_64.rs | Replace glob arch import with explicit intrinsic imports. |
| crates/shared/ab-proof-of-space/src/lib.rs | Avoid copying found_proofs by passing it by reference. |
| crates/shared/ab-proof-of-space/src/chiapos/table/tests.rs | Rewrite match-check helper to use unsigned/modular arithmetic. |
| crates/shared/ab-proof-of-space/src/chiapos/table.rs | Simplify MaybeUninit handling by using assume_init_ref() instead of raw Vec conversion. |
| crates/shared/ab-proof-of-space/src/chiapos.rs | Align found_proofs access with ref-based helper signature. |
| crates/shared/ab-networking/src/utils/piece_provider.rs | Prefer explicit Vec::new() and add Clippy expect reason. |
| crates/shared/ab-networking/src/protocols/reserved_peers/tests.rs | Improve ignored test annotation and use explicit unit patterns in select!. |
| crates/shared/ab-networking/src/protocols/reserved_peers.rs | Use unit pattern for unused handler event to satisfy linting. |
| crates/shared/ab-networking/src/protocols/request_response/request_response_factory/tests.rs | Replace result-state asserts with unwrap_err()-style checks. |
| crates/shared/ab-networking/src/protocols/request_response/request_response_factory.rs | Minor API/lint cleanups: explicit generics, concrete initializers, FuturesUnordered import. |
| crates/shared/ab-networking/src/protocols/request_response/handlers/cached_piece_by_index/tests.rs | Replace is_err() asserts with unwrap_err() for Clippy. |
| crates/shared/ab-networking/src/protocols/autonat_wrapper.rs | Prefer explicit HashSet::new() initialization. |
| crates/shared/ab-networking/src/node_runner.rs | Lint-driven pattern cleanups; box/unbox identify events and make periodic handler sync. |
| crates/shared/ab-networking/src/behavior/tests.rs | Prefer explicit HashSet::new() in config initialization. |
| crates/shared/ab-networking/src/behavior/persistent_parameters.rs | Use explicit collection initializers and switch an event bag type. |
| crates/shared/ab-networking/src/behavior.rs | Box IdentifyEvent in behaviour Event enum; add From<IdentifyEvent> impl. |
| crates/shared/ab-core-primitives/src/solutions.rs | Replace ambiguous defaults with concrete hash defaults. |
| crates/shared/ab-core-primitives/src/segments.rs | Move SegmentRoot::is_valid() impl block and keep logic intact. |
| crates/shared/ab-core-primitives/src/pieces/flat_pieces.rs | Gate parallel-only methods with per-method cfgs instead of impl block. |
| crates/shared/ab-core-primitives/src/pieces.rs | Remove unused/undesired conversion impl to satisfy linting/safety expectations. |
| crates/shared/ab-core-primitives/src/checksum/tests.rs | Replace is_err() asserts with unwrap_err(). |
| crates/shared/ab-core-primitives/src/block/body.rs | Add explicit clippy::partial_pub_fields expectation with reason. |
| crates/shared/ab-chacha8/src/lib.rs | Add reasoned Clippy expect for rust-gpu workaround loop. |
| crates/shared/ab-archiving/tests/integration/piece_reconstruction.rs | Simplify error assertions using assert_matches!. |
| crates/shared/ab-archiving/tests/integration/archiver.rs | Replace ambiguous defaults with concrete type defaults. |
| crates/shared/ab-archiving/benches/archiving.rs | Prefer explicit Vec::new() in benchmark calls. |
| crates/node/ab-node/src/cli/run/chain_spec.rs | Use concrete crypto defaults (Ed25519PublicKey/Signature) and import them. |
| crates/node/ab-node-rpc-server/src/lib.rs | Make notification handlers sync and adjust select! patterns accordingly. |
| crates/node/ab-client-proof-of-time/src/source/timekeeper.rs | Use saturating_sub to avoid duration underflow. |
| crates/node/ab-client-database/src/lib.rs | Add reasoned clippy::empty_drop expectation. |
| crates/farmer/ab-proof-of-space-gpu/src/shader/types.rs | Prefer self receivers for Copy types to satisfy Clippy. |
| crates/farmer/ab-proof-of-space-gpu/src/shader/sort_buckets/gpu_tests.rs | Update wgpu compute pass descriptor usage. |
| crates/farmer/ab-proof-of-space-gpu/src/shader/find_proofs/gpu_tests.rs | Update wgpu compute pass descriptor usage. |
| crates/farmer/ab-proof-of-space-gpu/src/shader/find_matches_in_buckets/gpu_tests.rs | Update wgpu compute pass descriptor usage. |
| crates/farmer/ab-proof-of-space-gpu/src/shader/find_matches_and_compute_fn/gpu_tests.rs | Update wgpu compute pass descriptor usage. |
| crates/farmer/ab-proof-of-space-gpu/src/shader/find_matches_and_compute_fn.rs | Add reasoned Clippy expect for rust-gpu workaround loop. |
| crates/farmer/ab-proof-of-space-gpu/src/shader/find_matches_and_compute_f7/gpu_tests.rs | Update wgpu compute pass descriptor usage. |
| crates/farmer/ab-proof-of-space-gpu/src/shader/find_matches_and_compute_f7.rs | Add reasoned Clippy expect for rust-gpu workaround loop. |
| crates/farmer/ab-proof-of-space-gpu/src/shader/find_matches_and_compute_f2/gpu_tests.rs | Update wgpu compute pass descriptor usage. |
| crates/farmer/ab-proof-of-space-gpu/src/shader/find_matches_and_compute_f2.rs | Add reasoned Clippy expect for rust-gpu workaround loop. |
| crates/farmer/ab-proof-of-space-gpu/src/shader/compute_f1/gpu_tests.rs | Update wgpu compute pass descriptor usage. |
| crates/farmer/ab-proof-of-space-gpu/src/shader/compute_f1.rs | Minor const-fn refactor for gcd implementation. |
| crates/farmer/ab-farmer/src/utils/tests.rs | Replace is_err() asserts with unwrap_err(). |
| crates/farmer/ab-farmer/src/single_disk_farm/plotting.rs | Add reason to too_many_arguments expectation. |
| crates/farmer/ab-farmer/src/single_disk_farm/piece_reader.rs | Add reason to too_many_arguments expectation. |
| crates/farmer/ab-farmer/src/single_disk_farm/farming.rs | Add reason to type_complexity expectation. |
| crates/farmer/ab-farmer/src/single_disk_farm/block_sealing.rs | Tighten match arm to Ok(()). |
| crates/farmer/ab-farmer/src/single_disk_farm.rs | Prefer self receiver for Copy enum helpers; unit-pattern select! cleanup. |
| crates/farmer/ab-farmer/src/plotter/gpu.rs | Add reason to too_many_arguments expectation. |
| crates/farmer/ab-farmer/src/plotter/cpu.rs | Add reason to too_many_arguments expectation. |
| crates/farmer/ab-farmer/src/plotter.rs | Add reason to too_many_arguments expectation on trait methods. |
| crates/farmer/ab-farmer/src/node_client/caching_proxy_node_client.rs | Unit-pattern select! cleanup. |
| crates/farmer/ab-farmer/src/farm.rs | Add reasoned new_without_default expectations. |
| crates/farmer/ab-farmer/src/cluster/plotter.rs | Add reasoned clippy expectations; unit-pattern select! cleanup. |
| crates/farmer/ab-farmer/src/cluster/farmer.rs | Add reasoned new_without_default expectation; unit-pattern select! cleanup. |
| crates/farmer/ab-farmer/src/cluster/controller/caches.rs | Unit-pattern select! cleanup. |
| crates/farmer/ab-farmer/src/cluster/cache.rs | Add reasoned new_without_default expectation. |
| crates/farmer/ab-farmer/src/bin/ab-farmer/commands/shared/network.rs | Add reason to too_many_arguments expectation. |
| crates/farmer/ab-farmer/src/bin/ab-farmer/commands/benchmark.rs | Use concrete ShardMembershipEntropy::default() and import it. |
| crates/farmer/ab-farmer-components/src/proving.rs | Add TODO + reasoned too_many_arguments expectation. |
| crates/farmer/ab-farmer-components/src/plotting.rs | Add reasoned partial_pub_fields expectation for semi-opaque struct. |
| crates/farmer/ab-farmer-components/src/auditing.rs | Add reasoned too_many_arguments expectation. |
| crates/farmer/ab-farmer-components/benches/reading.rs | Replace defaults with explicit AsyncMutex/AtomicBool and Vec::new(). |
| crates/farmer/ab-farmer-components/benches/proving.rs | Replace defaults with explicit AsyncMutex/AtomicBool and Vec::new(). |
| crates/farmer/ab-farmer-components/benches/plotting.rs | Replace defaults with explicit AsyncMutex/AtomicBool and Vec::new(). |
| crates/farmer/ab-farmer-components/benches/auditing.rs | Replace defaults with explicit AsyncMutex/AtomicBool and Vec::new(). |
| crates/execution/ab-riscv-macros/src/build/execution_impl/extract_matches.rs | Use explicit syn token types instead of Default::default(). |
| crates/execution/ab-riscv-macros/src/build/enum_impl/add_missing_fields.rs | Use explicit syn::token::Brace for struct expr construction. |
| crates/execution/ab-riscv-macros/src/build/enum_impl.rs | Use explicit DotDot token for PatRest. |
| crates/execution/ab-riscv-macros/src/build/enum_definition.rs | Fix missing semicolon to satisfy linting/formatting. |
| crates/execution/ab-riscv-interpreter/src/zicsr/tests.rs | Replace is_err() asserts with unwrap_err(). |
| crates/execution/ab-riscv-interpreter/src/v/zvexx/muldiv/zvexx_muldiv_helpers.rs | Add reasoned modulo_arithmetic expectation. |
| crates/execution/ab-riscv-interpreter/src/v/zvexx/muldiv/tests.rs | Replace ok-asserts with direct .unwrap() in tests. |
| crates/execution/ab-riscv-interpreter/src/v/zvexx/fixed_point/tests.rs | Replace ok-asserts with direct .unwrap() in tests. |
| crates/execution/ab-riscv-interpreter/src/v/zvexx/config/tests.rs | Replace is_err() asserts with unwrap_err(). |
| crates/execution/ab-riscv-interpreter/src/rv64/m.rs | Add reasoned modulo_arithmetic expectation around remainder semantics. |
| crates/execution/ab-riscv-interpreter/src/rv32/m.rs | Add reasoned modulo_arithmetic expectation around remainder semantics. |
| crates/execution/ab-riscv-interpreter/src/rv32/c/zca/tests.rs | Use explicit operand values type instead of generic default. |
| crates/contracts/system/ab-system-contract-simple-wallet-base/src/payload.rs | Merge impl blocks to satisfy linting/structure expectations. |
| crates/contracts/example/ab-example-contract-wallet/tests/basic.rs | Use concrete Gas::default() and import Gas. |
| crates/contracts/example/ab-example-contract-wallet/benches/example-contract-wallet.rs | Use concrete Gas::default() and import Gas. |
| crates/contracts/core/ab-contracts-macros-impl/src/contract/method.rs | syn token defaults + numerous reasoned clippy allows/expectations in generated code. |
| crates/contracts/core/ab-contracts-macros-impl/src/contract.rs | Add reasoned wildcard import expectations and generated-trait attribute allowances. |
| crates/contracts/core/ab-contracts-common/src/metadata/decode.rs | Add temporary crate-level Clippy expect with upstream tracking link. |
| Cargo.toml | Reorganize Clippy lint allow list and add/relocate several allows with TODO notes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c0762ba to
77cf712
Compare
77cf712 to
3e87898
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mostly trivial changes, the only non-trivial change is finally rewriting the code originally ported from Chia in C++ to use unsigned integers instead of signed in
crates/shared/ab-proof-of-space/src/chiapos/table/tests.rs.Had to report a bunch of false-positives.