about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSamuel Moelius <sam@moeli.us>2025-02-22 19:34:30 -0500
committerSamuel Moelius <sam@moeli.us>2025-03-23 15:25:27 -0400
commit969b5ad65c393ba1e7e8ca2e18d6030867ef42c3 (patch)
tree493033820fd8d31625e079ee3c40a24e1ada0cfb
parent88b590bf4626df68b73fdb03840c7ce616ac5929 (diff)
downloadrust-969b5ad65c393ba1e7e8ca2e18d6030867ef42c3.tar.gz
rust-969b5ad65c393ba1e7e8ca2e18d6030867ef42c3.zip
Don't suggests deprecated congurations
-rw-r--r--clippy_config/src/conf.rs18
-rw-r--r--tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr9
2 files changed, 17 insertions, 10 deletions
diff --git a/clippy_config/src/conf.rs b/clippy_config/src/conf.rs
index 929e9c679ea..1b9ea464dc3 100644
--- a/clippy_config/src/conf.rs
+++ b/clippy_config/src/conf.rs
@@ -991,7 +991,23 @@ impl serde::de::Error for FieldError {
         // set and allows it.
         use fmt::Write;
 
-        let mut expected = expected.to_vec();
+        let metadata = get_configuration_metadata();
+        let deprecated = metadata
+            .iter()
+            .filter_map(|conf| {
+                if conf.deprecation_reason.is_some() {
+                    Some(conf.name.as_str())
+                } else {
+                    None
+                }
+            })
+            .collect::<Vec<_>>();
+
+        let mut expected = expected
+            .iter()
+            .copied()
+            .filter(|name| !deprecated.contains(name))
+            .collect::<Vec<_>>();
         expected.sort_unstable();
 
         let (rows, column_widths) = calculate_dimensions(&expected);
diff --git a/tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr b/tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr
index cd2c8499092..f2eaa66a4ae 100644
--- a/tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr
+++ b/tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr
@@ -29,13 +29,11 @@ error: error reading Clippy's configuration file: unknown field `foobar`, expect
            array-size-threshold
            avoid-breaking-exported-api
            await-holding-invalid-types
-           blacklisted-names
            cargo-ignore-publish
            check-incompatible-msrv-in-tests
            check-inconsistent-struct-field-initializers
            check-private-items
            cognitive-complexity-threshold
-           cyclomatic-complexity-threshold
            disallowed-macros
            disallowed-methods
            disallowed-names
@@ -51,7 +49,6 @@ error: error reading Clippy's configuration file: unknown field `foobar`, expect
            ignore-interior-mutability
            large-error-threshold
            lint-commented-code
-           lint-inconsistent-struct-field-initializers
            literal-representation-threshold
            matches-for-let-else
            max-fn-params-bools
@@ -124,13 +121,11 @@ error: error reading Clippy's configuration file: unknown field `barfoo`, expect
            array-size-threshold
            avoid-breaking-exported-api
            await-holding-invalid-types
-           blacklisted-names
            cargo-ignore-publish
            check-incompatible-msrv-in-tests
            check-inconsistent-struct-field-initializers
            check-private-items
            cognitive-complexity-threshold
-           cyclomatic-complexity-threshold
            disallowed-macros
            disallowed-methods
            disallowed-names
@@ -146,7 +141,6 @@ error: error reading Clippy's configuration file: unknown field `barfoo`, expect
            ignore-interior-mutability
            large-error-threshold
            lint-commented-code
-           lint-inconsistent-struct-field-initializers
            literal-representation-threshold
            matches-for-let-else
            max-fn-params-bools
@@ -219,13 +213,11 @@ error: error reading Clippy's configuration file: unknown field `allow_mixed_uni
            array-size-threshold
            avoid-breaking-exported-api
            await-holding-invalid-types
-           blacklisted-names
            cargo-ignore-publish
            check-incompatible-msrv-in-tests
            check-inconsistent-struct-field-initializers
            check-private-items
            cognitive-complexity-threshold
-           cyclomatic-complexity-threshold
            disallowed-macros
            disallowed-methods
            disallowed-names
@@ -241,7 +233,6 @@ error: error reading Clippy's configuration file: unknown field `allow_mixed_uni
            ignore-interior-mutability
            large-error-threshold
            lint-commented-code
-           lint-inconsistent-struct-field-initializers
            literal-representation-threshold
            matches-for-let-else
            max-fn-params-bools