Skip to content

Conversation

@tarcieri
Copy link
Member

@tarcieri tarcieri commented Jan 20, 2026

(NOTE: take 2, after I accidentally closed #1399)

Adds a set of workspace-level lints including common ones we've used in the past and others collected via running clippy::pedantic on several of our crates and looking for interesting ones.

Workspace-level lints require explict opt-in from each crate's Cargo.toml, so there's nothing forcing any crate to use them:

[lints]
workspace = true

That said, I have opted every crate in the workspace into these lints and gotten them all to pass except for wycheproof2blb which is an internal utility tool and I didn't feel like it was worth the hassle.

Even then, the lints are all set to "warn", so they can be easily overridden by #[allow(...)] attributes, including #![allow(...)] to shut them off at the granularity of an entire crate.

I managed to fix most of the issues that cargo clippy --fix didn't fix automatically including some missing documentation and documentation formatting issues.

The main thing I didn't fix was adding missing SAFETY comments, which is a problem with a few of the crates in this repo. I disabled a lint at the crate level and added a TODO where we're missing them and it wasn't easily corrected.

See also: RustCrypto/meta#24

Adds a set of workspace-level lints including common ones we've used in
the past and others collected via running `clippy::pedantic` on several
of our crates and looking for interesting ones.

Workspace-level lints require explict opt-in from each crate's
Cargo.toml, so there's nothing forcing any crate to use them:

    [lints]
    workspace = true

That said, I have opted every crate in the workspace into these lints
and gotten them all to pass except for `wycheproof2blb` which is an
internal utility tool and I didn't feel like it was worth the hassle.

Even then, the lints are all set to `"warn"`, so they can be easily
overridden by `#[allow(...)]` attributes, including `#![allow(...)]`
to shut them off at the granularity of an entire crate.

I managed to fix most of the issues that `cargo clippy --fix` didn't fix
automatically including some missing documentation and documentation
formatting issues.

The main thing I didn't fix was adding missing `SAFETY` comments,
which is a problem with a few of the crates in this repo. I disabled a
lint at the crate level and added a TODO where we're missing them and it
wasn't easily corrected.
@tarcieri tarcieri requested a review from newpavlov January 20, 2026 16:01
@tarcieri
Copy link
Member Author

A couple of changes from #1399

  • I added a clippy.toml with allow-unwrap-in-consts = true and allow-unwrap-in-tests = true
  • I removed the panic_in_result_fn lint

However the changes for above are still in there and I need to go back and clean them up.

Beyond that, we need a solution for minimal-versions still.

Anything else?

Copy link
Member

@newpavlov newpavlov left a comment

Choose a reason for hiding this comment

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

Duplicating comments from the previous PR.

@tarcieri
Copy link
Member Author

Alright, I think that's everything except what to do about minimal-versions. I opened RustCrypto/actions#51 with a potential fix

Copy link
Member

@newpavlov newpavlov left a comment

Choose a reason for hiding this comment

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

Approving on condition of minimal-versions being fixed.

tarcieri added a commit to RustCrypto/actions that referenced this pull request Jan 21, 2026
Generates a stub Cargo.toml at the workspace level which configures a
workspace with one member whose path is the current working directory.

I think this might resolve the problem I was having with using
workspace-level configs in conjunction with `minimal-versions` on
RustCrypto/utils#1411

Not sure how to test it
@tarcieri
Copy link
Member Author

Okay, getting closer...

Might actually end up needing something multi-line after all, heh

@tarcieri
Copy link
Member Author

Looks like RustCrypto/actions#53 did the trick and minimal-versions is now passing again. Let me re-enable it on everything in this PR and we can get it merged

@tarcieri tarcieri merged commit 281ce57 into master Jan 21, 2026
117 checks passed
@tarcieri tarcieri deleted the ci/workspace-level-clippy-config branch January 21, 2026 01:46
tarcieri added a commit that referenced this pull request Jan 21, 2026
These sorts of imperative-style loops are often one of the
easiest-to-read solutions to simple problems.

I thought I added this to #1411 but I guess it got lost along the way.
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