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

Use workspace level lints #5655

Merged
merged 5 commits into from
Jan 4, 2024
Merged

Use workspace level lints #5655

merged 5 commits into from
Jan 4, 2024

Conversation

faern
Copy link
Member

@faern faern commented Jan 4, 2024

New in Rust 1.74 is cargo managed linting and workspace level lints. Now when we have bumped our build containers to use newest Rust we can start using these.

This allows us to not explicitly specify deny lints in CI invocations of cargo clippy. It also allows us to not have to repeat wanted lints in every crate (#![deny(rust_2018_idioms)]), something we naturally forgot to do in a bunch of crates already 🤷.


This change is Reviewable

@faern faern requested a review from dlon January 4, 2024 10:30
@faern faern changed the title Workspace level lints Use workspace level lints Jan 4, 2024
Copy link
Member

@dlon dlon left a comment

Choose a reason for hiding this comment

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

Reviewed 51 of 51 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @faern)


Cargo.toml line 44 at r1 (raw file):

[workspace.lints.rust]
rust_2018_idioms = "deny"

We could probably use workspace lints in test as well.


talpid-core/src/lib.rs line 3 at r1 (raw file):

//! The core components of the talpidaemon VPN client.

#![deny(missing_docs)]

Maybe we should move these remaining lints to the (crate-level) [lints]. If they're possible to combine with workspace = true, that is.

Copy link
Member Author

@faern faern left a comment

Choose a reason for hiding this comment

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

Reviewable status: 50 of 63 files reviewed, 1 unresolved discussion (waiting on @dlon)


Cargo.toml line 44 at r1 (raw file):

Previously, dlon (David Lönnhager) wrote…

We could probably use workspace lints in test as well.

Done! And "cleaned" up that code to follow the new linting rules ✨ 🧹


talpid-core/src/lib.rs line 3 at r1 (raw file):

Previously, dlon (David Lönnhager) wrote…

Maybe we should move these remaining lints to the (crate-level) [lints]. If they're possible to combine with workspace = true, that is.

Sadly not. If I add:

[lints.rust]
missing_docs = "deny"

...to talpid-core/Cargo.toml, then I get:

error: failed to load manifest for workspace member `/build/mullvad-daemon`

Caused by:
  failed to load manifest for dependency `mullvad-relay-selector`

Caused by:
  failed to load manifest for dependency `talpid-core`

Caused by:
  failed to parse manifest at `/build/talpid-core/Cargo.toml`

Caused by:
  cannot override `workspace.lints` in `lints`, either remove the overrides or `lints.workspace = true` and manually specify the lints

You cannot both inherit lints and define your own in cargo.

@faern faern force-pushed the workspace-level-lints branch from 9335af9 to 620ba82 Compare January 4, 2024 14:49
Copy link
Member Author

@faern faern left a comment

Choose a reason for hiding this comment

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

Reviewable status: 50 of 63 files reviewed, all discussions resolved (waiting on @dlon)


talpid-core/src/lib.rs line 3 at r1 (raw file):

Previously, faern (Linus Färnstrand) wrote…

Sadly not. If I add:

[lints.rust]
missing_docs = "deny"

...to talpid-core/Cargo.toml, then I get:

error: failed to load manifest for workspace member `/build/mullvad-daemon`

Caused by:
  failed to load manifest for dependency `mullvad-relay-selector`

Caused by:
  failed to load manifest for dependency `talpid-core`

Caused by:
  failed to parse manifest at `/build/talpid-core/Cargo.toml`

Caused by:
  cannot override `workspace.lints` in `lints`, either remove the overrides or `lints.workspace = true` and manually specify the lints

You cannot both inherit lints and define your own in cargo.

Would of course be cool to require documentation on all public items in all crates. But I don't think that's a job for this PR if we decide to go there.

Copy link
Member

@dlon dlon left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 13 of 13 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@faern
Copy link
Member Author

faern commented Jan 4, 2024

Fixes DES-505

@faern faern force-pushed the workspace-level-lints branch from 620ba82 to d0ac040 Compare January 4, 2024 17:07
@faern faern merged commit 2d0bad0 into main Jan 4, 2024
43 checks passed
@faern faern deleted the workspace-level-lints branch January 4, 2024 17:33
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