Repository: mozilla/cargo-vet (rust)

Issue:
Error message should suggest `cargo vet fmt` on consistency errors?
After I resolved a git merge conflict in `imports.lock` by hand, I got the following error in CI where `cargo vet --locked` was run:

```
ERROR   × Your cargo-vet store (supply-chain) has consistency errors

Error:   × A file in the store is not correctly formatted:
(snip)
  help: run `cargo vet` without --locked to reformat files in the store
```

When I followed the help message and ran `cargo vet` without `--locked`, it didn't produce any change to the files in the store. (In case it ends up mattering, I did have a significant list of audits still suggested for safe-to-deploy.) I checked `--help` and decided the right command to run was `cargo vet fmt`, which did resolve this problem: `cargo vet --locked` no longer complains about the consistency errors, and it tells me which audits I am missing.

Pull request:
Suggest cargo vet fmt for formatting errors
Unlike the previous suggestion of `cargo vet`, this will reformat the incorrectly formatted document even if the tree currently fails to vet.

Fixes #617

Patch:
diff --git a/src/errors.rs b/src/errors.rs
index ae5f366..b9446c6 100644
--- a/src/errors.rs
+++ b/src/errors.rs
@@ -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,
 }


Test patch:
diff --git a/src/tests/snapshots/cargo_vet__tests__store_parsing__invalid_formatting.snap b/src/tests/snapshots/cargo_vet__tests__store_parsing__invalid_formatting.snap
index 354be2d..3935fe8 100644
--- a/src/tests/snapshots/cargo_vet__tests__store_parsing__invalid_formatting.snap
+++ b/src/tests/snapshots/cargo_vet__tests__store_parsing__invalid_formatting.snap
@@ -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
@@ -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
 
diff --git a/src/tests/snapshots/cargo_vet__tests__store_parsing__unknown_field_config.snap b/src/tests/snapshots/cargo_vet__tests__store_parsing__unknown_field_config.snap
index 5fbcf3b..944e04e 100644
--- a/src/tests/snapshots/cargo_vet__tests__store_parsing__unknown_field_config.snap
+++ b/src/tests/snapshots/cargo_vet__tests__store_parsing__unknown_field_config.snap
@@ -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