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

Clippy lints MSRV 1.56.1 #640

Merged
merged 1 commit into from
Feb 17, 2024
Merged

Clippy lints MSRV 1.56.1 #640

merged 1 commit into from
Feb 17, 2024

Conversation

storopoli
Copy link
Contributor

Nothing out of the ordinary.
The most alarming was the non-inclusive range in
test_utils.rs.

In some test functions I allowed myself to use
#[allow(clippy::type_complexity)] because clippy was asking to create a type instead of using the big tuple. Since these were used just once, I thought it was overkill.

Note, depends on:

Copy link
Member

@tcharding tcharding left a comment

Choose a reason for hiding this comment

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

Thanks for doing these man, appreciated - and the linter found a bug in the tests, linting for the WIN.

ACK bb29ecc

src/psbt/mod.rs Outdated
}

fn lookup_sha256(&self, h: &Pk::Sha256) -> Option<Preimage32> {
self.psbt.inputs[self.index]
.sha256_preimages
.get(&Pk::to_sha256(h))
.and_then(try_vec_as_preimage32)
.and_then(|x: &std::vec::Vec<u8>| try_vec_as_preimage32(x))
Copy link
Member

Choose a reason for hiding this comment

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

This won't work in no-std builds, just use plain old Vec, its imported already in this file using use prelude::*.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, this seems obvious now in retrospect...

for (i, c) in (b'A'..b'Z').enumerate() {
for (i, c) in (b'A'..=b'Z').enumerate() {
Copy link
Member

Choose a reason for hiding this comment

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

This changes the behaviour of the loop to now include 'Z', from looking at the code it looks like this was a bug and the change is correct but this change warranted a patch on its own with a comment on the bug. Since its test code, I think we can leave it as is now though.

BTW I've got deja vu reviewing this, I've definitely removed these lint warnings before somewhere. I can't remember where but I remember hitting this 'Z' thing especially.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I remember this too. #523 It was even mixed in with CI crap.

@tcharding
Copy link
Member

Woops I acked, but needs the Vec change. CI should catch that though.

@apoelstra
Copy link
Member

@storopoli ok, I merged your other two PRs. Can you rebase this one and get CI working?

Nothing out of the ordinary.
The most alarming was the non-inclusive range in
`test_utils.rs`.

In some test functions I allowed myself to use
`#[allow(clippy::type_complexity)]` because clippy
was asking to create a type instead of using the big
tuple. Since these were used just once, I thought it
was overkill.

Note, depends on:

- #639 (we can also merge this into it
instead of `master`)
- #638 (has some allows on dead_code)
@storopoli storopoli requested a review from apoelstra February 17, 2024 16:25
@apoelstra
Copy link
Member

Hooray!

@apoelstra
Copy link
Member

Lol @ the type_complexity one. We probably should actually create a struct for that. But that's a job for another PR.

Thanks very much for fixing CI. Funny how every clippy update finds a new category of "unnecessary &" errors that it previously did not detect.

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 e2636f3

@storopoli
Copy link
Contributor Author

Lol @ the type_complexity one. We probably should actually create a struct for that. But that's a job for another PR.

Probably a simple Tuple Struct

Funny how every clippy update finds a new category of "unnecessary &" errors that it previously did not detect.

Yes, clippy lints are truly amazing. Never stops to impress me...

@apoelstra apoelstra merged commit 18b1b30 into rust-bitcoin:master Feb 17, 2024
16 checks passed
@storopoli storopoli deleted the js/clippy-lints-1.56.1 branch February 17, 2024 22:17
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.

3 participants