-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed as not planned
Labels
A-diagnosticsArea: Error and warning messages generated by Cargo itself.Area: Error and warning messages generated by Cargo itself.C-enhancementCategory: enhancementCategory: enhancement
Description
subcommand to lint format of Cargo file
and an option for all commands to fail early if format is invalid
I have not found an actual usecase to justify this
but have been learning rust and maybe this will be useful for noobs to double-check
the smallest valid Cargo.toml
file is
[package]
name = "hello_world"
version = "0.0.1"
authors = [ "name <email@example.com>" ]
now let us say we leave out the name.
cargo build
will throw an error
failed to parse manifest at `/src/hello-rust/Cargo.toml`
Caused by:
expected a value of type `string` for the key `package.name`
will throw a warning for unused keys as well
[package]
name = "hello_world"
version = "0.0.1"
users = [ "name <email@example.com>" ]
warning "unused manifest key: package.users"
but exit status is zero and everything works
also no error is thrown for an unused section. example:
[package]
name = "hello_world"
version = "0.0.1"
authors = [ "Deepak Kannan <kannan.deepak@gmail.com>" ]
[dependency]
should have been dependencies
rather than dependency
above
PS: I have been using cargo build
for all these examples.
but am not sure, if the config is checked for unused params by each sub-command
stinodego
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Error and warning messages generated by Cargo itself.Area: Error and warning messages generated by Cargo itself.C-enhancementCategory: enhancementCategory: enhancement