From b7477254c5161b700f6bda00f3b923c3a0001d75 Mon Sep 17 00:00:00 2001 From: Roberto Aloi Date: Fri, 14 Feb 2025 05:26:40 -0800 Subject: [PATCH] Do not require enabled_lints property in .elp_lint.toml Summary: We were not deriving `default`, so the field was actually required. I suspect this was not intentional. Reviewed By: alanz Differential Revision: D69594761 fbshipit-source-id: c9e0fd3b5790a10f74923cbf956dbcf80646d4d4 --- crates/elp/src/lib.rs | 10 ++++++++++ crates/ide/src/diagnostics.rs | 1 + 2 files changed, 11 insertions(+) diff --git a/crates/elp/src/lib.rs b/crates/elp/src/lib.rs index 7471c1e676..3165daaf31 100644 --- a/crates/elp/src/lib.rs +++ b/crates/elp/src/lib.rs @@ -215,4 +215,14 @@ mod tests { "#]] .assert_eq(&toml::to_string::(&lint_config).unwrap()); } + + #[test] + fn serde_read_lint_config_empty_enabled() { + let content = r#" + disabled_lints = [] + "#; + let config = toml::from_str::(&content).unwrap(); + assert_eq!(config.enabled_lints, vec![]); + assert_eq!(config.disabled_lints, vec![]); + } } diff --git a/crates/ide/src/diagnostics.rs b/crates/ide/src/diagnostics.rs index 650c10d4d7..925980a0f8 100644 --- a/crates/ide/src/diagnostics.rs +++ b/crates/ide/src/diagnostics.rs @@ -659,6 +659,7 @@ impl DiagnosticsConfig { /// initially. But could by anything supported by serde. #[derive(Deserialize, Serialize, Default, Debug)] pub struct LintConfig { + #[serde(default)] pub enabled_lints: Vec, #[serde(default)] pub disabled_lints: Vec,