Skip to content

Commit

Permalink
Suggest cargo vet fmt for formatting errors
Browse files Browse the repository at this point in the history
Unlike the previous suggestion of `cargo vet`, this will reformat the
incorrectly formatted document even if the tree currently fails to vet.

Fixes #617
  • Loading branch information
mystor committed Jul 9, 2024
1 parent 25f4898 commit 13e9ea9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ pub struct InvalidCriteriaError {

#[derive(Debug, Error, Diagnostic)]
#[error("A file in the store is not correctly formatted:\n\n{unified_diff}")]
#[diagnostic(help("run `cargo vet` without --locked to reformat files in the store"))]
#[diagnostic(help("run `cargo vet fmt` to reformat files in the store"))]
pub struct BadFormatError {
pub unified_diff: String,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Error: × A file in the store is not correctly formatted:
version = "1.0.0"
criteria = "safe-to-deploy"
help: run `cargo vet` without --locked to reformat files in the store
help: run `cargo vet fmt` to reformat files in the store
Error: × A file in the store is not correctly formatted:
--- old/audits.toml
Expand All @@ -46,5 +46,5 @@ Error: × A file in the store is not correctly formatted:
-notes = "valid field"
+version = "2.0.0"
help: run `cargo vet` without --locked to reformat files in the store
help: run `cargo vet fmt` to reformat files in the store

Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ Error: × A file in the store is not correctly formatted:
criteria = "safe-to-deploy"
-unknown-field = "hi"
help: run `cargo vet` without --locked to reformat files in the store
help: run `cargo vet fmt` to reformat files in the store

0 comments on commit 13e9ea9

Please sign in to comment.