Add and Apply rust-bitcoin's Lints - #226
Conversation
47bef2f to
f9ae425
Compare
f9ae425 to
80feb72
Compare
|
ping @oleonardolima |
| @@ -194,7 +196,9 @@ pub fn convert_fee_rate(target_blocks: usize, estimates: HashMap<u16, FeeRate>) | |||
| } | |||
|
|
|||
| /// Convert a [`HashMap`] of fee estimates expressed as sat/vB ([`f64`]) into [`FeeRate`]s. | |||
| pub fn sat_per_vbyte_to_feerate(estimates: HashMap<u16, f64>) -> HashMap<u16, FeeRate> { | |||
| pub fn sat_per_vbyte_to_feerate<S: BuildHasher>( | |||
| estimates: HashMap<u16, f64, S>, | |||
| ) -> HashMap<u16, FeeRate> { | |||
There was a problem hiding this comment.
Is this really needed ?
There was a problem hiding this comment.
The implicit_hasher = "warn" lint enforces this. It doesn't really make that big of a difference, but allows the caller to pass a HashMap built with any BuildHasher implementation instead of forcing the default one.
| # Copied over from `rust-bitcoin` | ||
| [lints.clippy] | ||
| # Exclude lints we don't think are valuable. |
There was a problem hiding this comment.
Do we really need all of them ? Can't we have these in a clippy.toml instead ?
There was a problem hiding this comment.
It's good for code quality, these have been curated by the rust-bitcoin project over a long time, and they're sensible in my opinion.
I'd rather keep them on Cargo.toml.
There was a problem hiding this comment.
I'd prefer putting them in clippy.toml also since there are so many and it clutters up the Cargo.toml file.
There was a problem hiding this comment.
@notmandatory and @oleonardolima actually, these cannot be on clippy.toml and must be on Cargo.toml; see https://doc.rust-lang.org/stable/clippy/configuration.html#lints-section-in-cargotoml.
error: error reading Clippy's configuration file: unknown field `implicit_clone`, expected one of
absolute-paths-allowed-crates
absolute-paths-max-segments
accept-comment-above-attributes
accept-comment-above-statement
[...]
warn-on-all-wildcard-imports
warn-unsafe-macro-metavars-in-private-macros
--> /user/git/rust-esplora-client/clippy.toml:33:1
|
33 | implicit_clone = "warn"
| ^^^^^^^^^^^^^^
rust-bitcoin's lints are also setup in the same manner as this PR.
This PR adds and applies all of
rust-bitcoin'sclippylints and a few usefulrustlints.