Add and apply most of rust-bitcoin's lints#140
Conversation
* Bump the Rust edition to 2021 (released on Rust 1.56.0) * Add the `tools` field to `[package.metadata.rbmt]` such that CI and local `cargo-audit` and Zizmor versions are in sync * Update the Zizmor CI job to set up rbmt's tools * Update the justfile and README
c2e655d to
de8c93a
Compare
|
Added the ~$ cargo rbmt test
[...]
Tests complete.
Test Summary
Commit: de8c93a0b0bdd4864cb512bd5344a81a925cf2a2
Package: rustreexo
Examples : stump_modify, stump_modify:std, stump_modify:with-serde, stump_modify:with-serde std, proof_update, proof_update:std, proof_update:with-serde, proof_update:with-serde std, custom_hash, custom_hash:std, custom_hash:with-serde, custom_hash:with-serde std
Individual features: serde, std, with-serde
Feature subsets : [serde, std], [serde, with-serde], [std, with-serde]
+ No-std check : ran |
1bdc74d to
243e3cb
Compare
| cargo rbmt test --toolchain msrv --lockfile minimal | ||
|
|
||
| [doc: "Install cargo-rbmt tools"] | ||
| tools: |
There was a problem hiding this comment.
nit: install-tools?
There was a problem hiding this comment.
I think setup or bootstrap are better names, what do you think?
| cached_del_hashes: Vec<Hash>, | ||
| remembers: Vec<u64>, |
There was a problem hiding this comment.
Why not making the others a reference as well?
There was a problem hiding this comment.
I just fixed whatever clippy complained about, we can go over all param types on a follow-up.
| util::get_proof_positions(&new_target_pos, num_leaves, util::tree_rows(num_leaves)); | ||
| needed_proof_positions.sort(); | ||
| get_proof_positions(&new_target_pos, num_leaves, tree_rows(num_leaves)); | ||
| needed_proof_positions.sort_unstable(); |
There was a problem hiding this comment.
de8c93a
Hmm, I wonder if this could have implications. Is there a way were we could screw up the order?
There was a problem hiding this comment.
I think it's fine, given need_proof_positions is a stable primitive (Vec<u64>).
error: used `sort` on primitive type `u64`
--> src/proof/mod.rs:792:9
|
792 | needed_proof_positions.sort();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `needed_proof_positions.sort_unstable()`
|
= note: an unstable sort typically performs faster without any observable difference for this data type
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#stable_sort_primitive
= note: `-D clippy::stable-sort-primitive` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::stable_sort_primitive)]`
| trivially_copy_pass_by_ref = "warn" | ||
| unchecked_time_subtraction = "warn" | ||
| unicode_not_nfc = "warn" | ||
| uninlined_format_args = "allow" # This is a subjective style choice. |
There was a problem hiding this comment.
I actually like this one
The `default_trait_access` lint complained that we were instantiating a `HashMap` with `HashMap::with_hasher(Default::default())`. I've mirrored the helpers on the `std` prelude such that we may keep the two in sync.
Import the `std` crate, feature gated on the `std` feature, and add the `#![no_std]` attribute such that `cargo-rbmt` also tests the crate in a no-std target (`thumbv7m-none-eabi`).
Add and apply all `rust-bitcoin` lints, except for documentation lints.
243e3cb to
425181b
Compare
Changelog