Skip to content

New lint: missing_workspace_lints#15092

Closed
BenjaminBrienen wants to merge 1 commit intorust-lang:masterfrom
BenjaminBrienen:unused-workspace-lints
Closed

New lint: missing_workspace_lints#15092
BenjaminBrienen wants to merge 1 commit intorust-lang:masterfrom
BenjaminBrienen:unused-workspace-lints

Conversation

@BenjaminBrienen
Copy link
Contributor

@BenjaminBrienen BenjaminBrienen commented Jun 21, 2025

Adds a new lint for when your workspace has a lint configuration table, but a member of the workspace implicitly does not inherit that configuration. This has bitten me in the butt many times in my large workspace with many crates where I forget to add lints.workspace = true.

Example in rust-analyzer!

Worked on with @NateD-MSFT during the RustWeek workshop.

changelog: [missing_workspace_lints]: Added new lint to warn when a project is in a workspace with workspace lint configuration, but has not explicitly configured lints.workspace.

@rustbot
Copy link
Collaborator

rustbot commented Jun 21, 2025

r? @samueltardieu

rustbot has assigned @samueltardieu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jun 21, 2025
@BenjaminBrienen BenjaminBrienen force-pushed the unused-workspace-lints branch 3 times, most recently from 1e4b341 to 9ecf6da Compare June 21, 2025 01:26
@BenjaminBrienen BenjaminBrienen force-pushed the unused-workspace-lints branch from 9ecf6da to 9d20899 Compare June 21, 2025 01:28
@samueltardieu
Copy link
Member

I think this should be a Cargo lint instead. "lints" are probably not the only key which should be checked, for example edition, rust-version and license should be as well.

@samueltardieu
Copy link
Member

Worked on with @NateD-MSFT during the RustWeek workshop.

r? @llogiq

@rustbot rustbot assigned llogiq and unassigned samueltardieu Jun 21, 2025
@BenjaminBrienen
Copy link
Contributor Author

Clippy already has a few cargo lints and I think it even checks for missing basic metadata (allow by default). If they get moved into cargo itself, this could move with them?

@samueltardieu
Copy link
Member

Dear contributor. Clippy has entered a feature freeze period and will not be integrating new lints for a few weeks. You can rest assured that the Clippy team will review and discuss your proposal at the end of the feature freeze period.

If you wish to contribute to Clippy in the meantime, do not hesitate to read the pinned tracking issue about the feature freeze itself.

@rustbot label +A-lint +S-blocked -S-waiting-on-review
@rustbot note "Feature freeze"

@rustbot rustbot added A-lint Area: New lints S-blocked Status: marked as blocked ❌ on something else such as an RFC or other implementation work and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Jun 30, 2025
@samueltardieu samueltardieu added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-blocked Status: marked as blocked ❌ on something else such as an RFC or other implementation work labels Sep 17, 2025
@ada4a
Copy link
Contributor

ada4a commented Oct 11, 2025

@rustbot note remove "Feature freeze"

@samueltardieu samueltardieu added the needs-fcp PRs that add, remove, or rename lints and need an FCP label Oct 17, 2025
@epage
Copy link
Contributor

epage commented Feb 3, 2026

With Cargo's linting system being developed, I thought there was a pause on adding new cargo lints to clippy.

rust-lang/cargo#15579 is the issue for the Cargo lint.

@samueltardieu
Copy link
Member

With Cargo's linting system being developed, I thought there was a pause on adding new cargo lints to clippy.

rust-lang/cargo#15579 is the issue for the Cargo lint.

Note that this was developed during RustWeek's workshop, before we discussed Clippy/cargo linting. Indeed, if a similar Cargo lint is ongoing, this should be added there instead.

@epage
Copy link
Contributor

epage commented Feb 3, 2026

I can understand this being developed days before that conversation but we are now almost a year out from that and this is unmerged. imo we should not merge any more cargo:: lints into clippy.

@samueltardieu
Copy link
Member

Agreed (from the start)

@samueltardieu samueltardieu added the T-cargo Type: cargo related label Feb 3, 2026
@samueltardieu
Copy link
Member

Closing as moot now that cargo lints are a thing.

epage added a commit to epage/cargo that referenced this pull request Feb 4, 2026
Fixes rust-lang#15579

Some naming inspiration from rust-lang/rust-clippy#15092.

There are several ways to go with this lint and I'm leaving the final
decisions to the stabilization conversations.
- Could be called `missing_lints` but that makes it sound like its
  needed even when there is no `workspace.lints`
- The name implies it should lint for an empty `[lints]`
  - Naming to be specific enough is hard
  - We could lint on a `[lints]` without `workspace = true` but then
    they will have to turn this lint to `allow` when intentionally not
    inheriting, adding boilerplate, while we're mainly trying to cover the
    case of people thinking implicit inheritance is a thing.
epage added a commit to epage/cargo that referenced this pull request Feb 4, 2026
Fixes rust-lang#15579

Some naming inspiration from rust-lang/rust-clippy#15092.

There are several ways to go with this lint and I'm leaving the final
decisions to the stabilization conversations.
- Could be called `missing_lints` but that makes it sound like its
  needed even when there is no `workspace.lints`
- The name implies it should lint for an empty `[lints]`
  - Naming to be specific enough is hard
  - We could lint on a `[lints]` without `workspace = true` but then
    they will have to turn this lint to `allow` when intentionally not
    inheriting, adding boilerplate, while we're mainly trying to cover the
    case of people thinking implicit inheritance is a thing.
github-merge-queue bot pushed a commit to rust-lang/cargo that referenced this pull request Feb 5, 2026
### What does this PR try to resolve?

Fixes #15579

### How to test and review this PR?

Some naming inspiration from rust-lang/rust-clippy#15092.

There are several ways to go with this lint and I'm leaving the final
decisions to the stabilization conversations.
- Could be called `missing_lints` but that makes it sound like its
  needed even when there is no `workspace.lints`
- The name implies it should lint for an empty `[lints]`
  - Naming to be specific enough is hard
  - We could lint on a `[lints]` without `workspace = true` but then
    they will have to turn this lint to `allow` when intentionally not
inheriting, adding boilerplate, while we're mainly trying to cover the
    case of people thinking implicit inheritance is a thing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-lint Area: New lints needs-fcp PRs that add, remove, or rename lints and need an FCP S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) T-cargo Type: cargo related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants