b6ad6fc5aa
Improve "unknown field" error messages
Fixes #8806
Sample output:
```
error: error reading Clippy's configuration file `/home/smoelius/github/smoelius/rust-clippy/clippy.toml`: unknown field `foobar`, expected one of
allow-expect-in-tests enable-raw-pointer-heuristic-for-send standard-macro-braces
allow-unwrap-in-tests enforced-import-renames third-party
allowed-scripts enum-variant-name-threshold too-large-for-stack
array-size-threshold enum-variant-size-threshold too-many-arguments-threshold
avoid-breaking-exported-api literal-representation-threshold too-many-lines-threshold
await-holding-invalid-types max-fn-params-bools trivial-copy-size-limit
blacklisted-names max-include-file-size type-complexity-threshold
cargo-ignore-publish max-struct-bools unreadable-literal-lint-fractions
cognitive-complexity-threshold max-suggested-slice-pattern-length upper-case-acronyms-aggressive
cyclomatic-complexity-threshold max-trait-bounds vec-box-size-threshold
disallowed-methods msrv verbose-bit-mask-threshold
disallowed-types pass-by-value-size-limit warn-on-all-wildcard-imports
doc-valid-idents single-char-binding-names-threshold
at line 1 column 1
```
You can test this by (say) adding `foobar = 42` to Clippy's root `clippy.toml` file, and running `cargo run --bin cargo-clippy`.
Note that, to get the terminal width, this PR adds `termize` as a dependency to `cargo-clippy`. However, `termize` is also [how `rustc_errors` gets the terminal width](
|
||
---|---|---|
.. | ||
await_holding_invalid_type | ||
bad_toml | ||
bad_toml_type | ||
conf_deprecated_key | ||
expect_used | ||
fn_params_excessive_bools | ||
functions_maxlines | ||
good_toml_no_false_negatives | ||
invalid_min_rust_version | ||
large_include_file | ||
lint_decimal_readability | ||
max_suggested_slice_pattern_length | ||
min_rust_version | ||
missing_enforced_import_rename | ||
nonstandard_macro_braces | ||
strict_non_send_fields_in_send_ty | ||
struct_excessive_bools | ||
toml_blacklist | ||
toml_disallowed_methods | ||
toml_disallowed_types | ||
toml_trivially_copy | ||
toml_unknown_key | ||
unwrap_used | ||
upper_case_acronyms_aggressive | ||
vec_box_sized | ||
zero_single_char_names | ||
update-all-references.sh |