Skip to content

Conversation

@tcharding
Copy link
Member

After doing #668 I wanted to be able to use the just sane command before pushing PRs, so fix the lint issues.

clippy emits:

  error: redundant field names in struct initialization

As suggested, remove redundant field names in struct initialization
clippy emits:

  error: this expression creates a reference which is immediately
  dereferenced by the compiler

As suggested, remove the explicit reference.
clippy emits two warnings of form:

 error: using `clone` on type ... which implements the `Copy` trait

As suggested, remove redundant call to `clone()`.
clippy emits:

  error: redundant closure

As suggested, remove the redundant closure.
clippy emits:

  error: using `Result.and_then(|x| Ok(y))`, which is more succinctly
  expressed as `map(|x| y)`

As suggested, use `map` combinator.
The explicit array access is clear, just shoosh the linter.
Get more Rusty, use iterator instead of array access. While we are at it
don't explicitly create the slice, that is a hangover from Rust 1.48
clippy emits:

 error: field assignment outside of initializer for an instance created
 with Default::default()

Use struct update syntax instead.
This was referenced Mar 28, 2024
Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 7634642 thanks! we should re-enabled Clippy in CI in this repo...I believe we disabled it due to a clippy bug in July

@apoelstra apoelstra merged commit f44943d into rust-bitcoin:master Mar 29, 2024
@tcharding tcharding deleted the 03-28-clippy branch April 1, 2024 03:50
heap-coder added a commit to heap-coder/rust-miniscript that referenced this pull request Sep 27, 2025
76346427f9f1ea8624ca6e1e1bb228a718c26e88 Use struct update syntax (Tobin C. Harding)
2bc083e607da8609d82123cd3505071898e4a14a Use iterator instead of manual loop (Tobin C. Harding)
6d663e15cee0586579fd5ef00812b3875b6ae382 Allow range loop in test code (Tobin C. Harding)
a8c156e8787798f8d2b728d9adc54332a865c015 Use map instead of and_then (Tobin C. Harding)
d5662dae0152f27bb81e464dbc9a91cd409e8109 Remove redundant closure (Tobin C. Harding)
90f1585a2f163f6328952fd56b272a6e05457e08 Remove redundant clone (Tobin C. Harding)
409d4b08af6213ab75fb78f78e68be2b024e5da3 Remove explicit reference (Tobin C. Harding)
9ec6b1767f2c182a40349b8d58e3c88252dafc61 Remove redundant field names in struct initialization (Tobin C. Harding)

Pull request description:

  After doing #668 I wanted to be able to use the `just sane` command before pushing PRs, so fix the lint issues.

ACKs for top commit:
  apoelstra:
    ACK 76346427f9f1ea8624ca6e1e1bb228a718c26e88 thanks! we should re-enabled Clippy in CI in this repo...I believe we disabled it due to a clippy bug in July

Tree-SHA512: 1e953f2fc1a6e649324293a84abf1be54feca6095111653af046aacf17a83e6ae15452fe8825599ccbfae0ea84fe7d1988c8b72d5dd902c9d0fb1d34e660ef8b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants