rust-lang / rust-lang/cargo

Suggest typo corrections in Cargo.toml

Open
#9,731 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-diagnostics A-toml C-feature-request S-needs-design
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

Describe the problem you are trying to solve
Rust does an excellent job at catching and providing suggestions for typos in Rust code, but I feel the same is lacking in Cargo.

Given the following Cargo.toml:

[package]
name = "tmp"
version = "0.1.0"
edition = "2018"
[dependencies]
serde = { version = "1.0.126", feature = ["derive"] }

Running cargo build only hints that there is an issue:

❯ cargo build
warning: unused manifest key: dependencies.serde.feature

Describe the solution you'd like
A suggestion similar to the Rust compiler:

error[E12345]: unknown dependency attribute `feature`
 --> Cargo.toml:6:32
  |
6 |     serde = { version = "1.0.126", feature = ["derive"] }
  |                                    ^^^ help: did you mean `features`?

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 reproducing the warning with the Cargo.toml example and running cargo build. Trace how Cargo reports the unused manifest key, then define completion as a diagnostic that points to the misspelled dependency attribute and suggests features as shown in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.