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

Add clippy at workspace level #766

Merged
merged 13 commits into from
May 27, 2024
Merged

Conversation

tcoratger
Copy link
Contributor

Description

This pull request adds the Clippy tool at the workspace level. By enabling Clippy at the workspace level, it will run on all projects within the workspace, providing consistent linting across the entire codebase.

Changes Made

  • Added Clippy as a development dependency in the workspace's Cargo.toml file.
  • Configured Clippy through the clippy.toml file to customize linting rules and configurations.

Copy link
Member

@onbjerg onbjerg left a comment

Choose a reason for hiding this comment

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

sensible idea to me

Comment on lines +15 to +23
[workspace.lints]
rust.missing_debug_implementations = "warn"
rust.missing_docs = "warn"
rust.unreachable_pub = "warn"
rust.unused_must_use = "deny"
rust.rust_2018_idioms = "deny"
rustdoc.all = "warn"

[workspace.lints.clippy]
Copy link
Member

Choose a reason for hiding this comment

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

unsure about these, defer to @prestwich and @mattsse if we should just keep this default or not

obviously some of them should be kept to allow us to remove some of the #![warn] and #![deny]s

Copy link
Member

Choose a reason for hiding this comment

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

this is a big list to review.

some of them, like missing_const_for_fn are definitely not set correctly. we do want to enforce missing_const_for_fn, in spite of the bug wrt const fn destructors

For nursery lints, the comment needs to be dated with when the list was reproduced here, and link to documentation of the full list of nursery lints. It needs to be maintained regularly or will fall out of date with the nursery. This is the sort of annoying churn and manual overhead that I try to avoid and is why we stopped using nightly clippy in the first place

Overall, I am in favor of dropping the whole list and keeping defaults

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@prestwich But if we keep only the default, this means the following list

rust.missing_debug_implementations = "warn"
rust.missing_docs = "warn"
rust.unreachable_pub = "warn"
rust.unused_must_use = "deny"
rust.rust_2018_idioms = "deny"
rustdoc.all = "warn"

and for example we omit use_self which was quite useful here or missing_const_for_fn that I can add to the warn list (my bad). As a ref, I used the same list as in reth.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@prestwich I've just updated by pushing all (all lints that are on by default (correctness, suspicious, style, complexity, perf))

I added 3 others as supplements which seem stable and quite useful compared to what we have in the codebase:

missing_const_for_fn = "warn"
use_self = "warn"
option_if_let_else = "warn"

tell me what you think?

Copy link
Member

Choose a reason for hiding this comment

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

Cool, this looks fine for me. Can merge once we re-apply the lints on latest main

@@ -3,16 +3,7 @@
html_logo_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/alloy.jpg",
html_favicon_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/favicon.ico"
)]
#![warn(
Copy link
Member

Choose a reason for hiding this comment

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

good. appreciate deleting these.

@prestwich
Copy link
Member

will give this another pass in the morning

@prestwich
Copy link
Member

sorry, i thought i left a comment days ago. i'm good with the approach and will approve and merge once re-applied to main

@tcoratger
Copy link
Contributor Author

sorry, i thought i left a comment days ago. i'm good with the approach and will approve and merge once re-applied to main

Just did a rebase :)

@prestwich prestwich merged commit aed6de2 into alloy-rs:main May 27, 2024
24 checks passed
ben186 pushed a commit to ben186/alloy that referenced this pull request Jul 27, 2024
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