rust-lang / rust-lang/rust-clippy

Read clippy configuration normally found in `clippy.toml` from `Cargo.toml`

Open
#10,890 6 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-question
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

Description

Cross-posting from:

I love seeing config converging into Cargo.toml. This will help to address some papercuts when working in workspaces with many crates.

I know it is out of scope for this tracking issue, but mentioning it here since it seems relevant to the general idea. Other first party Rust tools have lots of configuration files of their own. I'd love rustup, rustfmt, and clippy to look in Cargo.toml for the configuration that today is found in rust-toolchain.toml, rustfmt.toml, and clippy.toml.

Originally posted by @lopopolo in https://github.com/rust-lang/cargo/issues/12115#issuecomment-1575681614

I would like to reduce the proliferation of configuration files in the root of my repositories as much as possible. Would it be possible and/or an accepted feature to read the config normally found in clippy.toml (like doc-valid-idents) from Cargo.toml?

I don't believe this requires dedicated support from the Cargo team and could be done today with tool-specific metadata, like this example for configuring docs.rs:

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
Version
rustc 1.70.0 (90c541806 2023-05-31)
binary: rustc
commit-hash: 90c541806f23a127002de5b4038be731ba1458ca
commit-date: 2023-05-31
host: x86_64-apple-darwin
release: 1.70.0
LLVM version: 16.0.2
Additional Labels

@rustbot label +C-question

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading Clippy's existing handling of clippy.toml and how Cargo.toml package metadata is exposed to tools; no source files or tests are named in the issue. Done means configuration such as doc-valid-idents can be supplied from Cargo.toml while preserving the existing clippy.toml behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.