Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix all lint errors and warnings #670

Merged
merged 8 commits into from
Mar 29, 2024

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
16 checks passed
@tcharding tcharding deleted the 03-28-clippy branch April 1, 2024 03:50
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