From d99794766f75a70852a942331bb50a711ff63bbb Mon Sep 17 00:00:00 2001 From: Anthony Date: Thu, 11 Sep 2025 19:11:20 -0400 Subject: [PATCH] Fix auto update setting defaulting to false --- crates/auto_update/src/auto_update.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/crates/auto_update/src/auto_update.rs b/crates/auto_update/src/auto_update.rs index f0ae3fdb1cfef667a9f737aa6545a42046a9d322..e6e5f7ac926ba80de5379974200e490bae1b8d96 100644 --- a/crates/auto_update/src/auto_update.rs +++ b/crates/auto_update/src/auto_update.rs @@ -120,7 +120,7 @@ struct AutoUpdateSetting(bool); /// Default: true #[derive(Clone, Copy, Default, JsonSchema, Deserialize, Serialize, SettingsUi)] #[serde(transparent)] -struct AutoUpdateSettingContent(bool); +struct AutoUpdateSettingContent(Option); impl Settings for AutoUpdateSetting { const KEY: Option<&'static str> = Some("auto_update"); @@ -135,17 +135,18 @@ impl Settings for AutoUpdateSetting { sources.user, ] .into_iter() - .find_map(|value| value.copied()) - .unwrap_or(*sources.default); + .find_map(|value| value.and_then(|val| val.0)) + .or(sources.default.0) + .ok_or_else(Self::missing_default)?; - Ok(Self(auto_update.0)) + Ok(Self(auto_update)) } fn import_from_vscode(vscode: &settings::VsCodeSettings, current: &mut Self::FileContent) { let mut cur = &mut Some(*current); vscode.enum_setting("update.mode", &mut cur, |s| match s { - "none" | "manual" => Some(AutoUpdateSettingContent(false)), - _ => Some(AutoUpdateSettingContent(true)), + "none" | "manual" => Some(AutoUpdateSettingContent(Some(false))), + _ => Some(AutoUpdateSettingContent(Some(true))), }); *current = cur.unwrap(); }