Skip to content

Commit

Permalink
Do not require enabled_lints property in .elp_lint.toml
Browse files Browse the repository at this point in the history
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
  • Loading branch information
robertoaloi authored and facebook-github-bot committed Feb 14, 2025
1 parent 4bc4f51 commit b747725
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions crates/elp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,14 @@ mod tests {
"#]]
.assert_eq(&toml::to_string::<LintConfig>(&lint_config).unwrap());
}

#[test]
fn serde_read_lint_config_empty_enabled() {
let content = r#"
disabled_lints = []
"#;
let config = toml::from_str::<LintConfig>(&content).unwrap();
assert_eq!(config.enabled_lints, vec![]);
assert_eq!(config.disabled_lints, vec![]);
}
}
1 change: 1 addition & 0 deletions crates/ide/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<DiagnosticCode>,
#[serde(default)]
pub disabled_lints: Vec<DiagnosticCode>,
Expand Down

0 comments on commit b747725

Please sign in to comment.