Skip to content

ci: fix clippy lints and a couple other small things #295

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

Merged
merged 3 commits into from
Jul 14, 2025
Merged

Conversation

apoelstra
Copy link
Collaborator

  • Fix clippy lints
  • Enable a few more lints related to casting
  • Fix CI to use the nightly-version version of clippy so that we won't break as new lints come out

Reads MSRV from clippy.toml rather than hardcoding it; uses nightly
compiler for clippy runs; adds cronjob to update nightly compiler pin.
Mostly they are complaining about the new "format specifiers can
directly hold the variable, if that variable is a single token, and if
the format specifier is in println or format but not write or assert, so
you should convert 40% of your instances to this different format,
because it makes a big diff and leaves your code in an unreadable state"
lint, which personally I don't feel is a net benefit.

Copy the whole list of whitelisted clippy lints from rust-elements.
There is a huge list of lints I'd like to enable (currently in
rust-elements and a few other crates). As a start, enable the
cast_lossless one, which I think is very important: it complaints if you
use a cast where usize::from() would suffice.

The benefit of the from() syntax is that it will compile iff the cast
cannot truncate. So the reader of the code can tell immediately that
there is no danger of changing the value, and if the lint is on,
conversely the reader can tell that anything that *is* a cast is
something that needs further scrutiny.
Copy link
Collaborator Author

@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.

On 48634a8 successfully ran local tests

@apoelstra
Copy link
Collaborator Author

cc @canndrew can you review this one as well (and this one won't get auto-pushed in a breaking way :P)

@canndrew
Copy link
Collaborator

ACK 48634a8

@apoelstra apoelstra merged commit b4758ad into master Jul 14, 2025
39 checks passed
@apoelstra apoelstra deleted the 2025-06_ci branch July 14, 2025 19:42
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