cargo icon indicating copy to clipboard operation
cargo copied to clipboard

Add non-lint `advice` messages controlled through a `[advice]` lint table

Open epage opened this issue 2 months ago • 3 comments

Problem

We have many situations where people would find additional information useful for new users at the cost of output blot.

Potential cases

  • cargo news see more Cargo.toml keys and their definitions
  • cargo add calling out the lib.name (#15887)
  • misnamed config (#8631)
  • suggest [workspace] when using path dependencies (#7589)
  • unused config relative to a --manifest-path (#2930)
  • No locking available (#16184)

Proposed Solution

Add a non-lint advice. This is meant to be slightly more verbose output of helpful suggestions that the user can turn off for less output, similar to git.

A fundamental difference between a lint and advice is that a lint is focused on the project while advice is focused on the user.

Notes

#9936 would be helpful so we can easily tell people how to disable advice

epage avatar Nov 12 '25 20:11 epage

Created this atm to help collect use cases s we can better evaluate this

epage avatar Nov 12 '25 20:11 epage

Would this table live in workspace/package manifests or in configuration? The use case feels more like a per-user config thing, but the lints table is workspace/package level and I didn’t see any explicit mention of config vs manifest.

hanna-kruppe avatar Nov 13 '25 12:11 hanna-kruppe

Config. I guess in my rewording I didn't say it explicitly but

  • it is labeled as configuration, rather than manifest
  • I call out this is user focused, rather than project.

epage avatar Nov 13 '25 12:11 epage