From d915fc26829e7ed68413a3c7556befcd0163a181 Mon Sep 17 00:00:00 2001 From: HsiangNianian Date: Wed, 14 Jan 2026 14:55:27 +0800 Subject: refactor: simplify default implementations for AccountStore and MsRefreshTokenState --- src-tauri/src/core/account_storage.rs | 9 +-------- src-tauri/src/core/auth.rs | 6 +++--- src-tauri/src/main.rs | 6 ++++++ 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src-tauri/src/core/account_storage.rs b/src-tauri/src/core/account_storage.rs index 9512213..5ab86e4 100644 --- a/src-tauri/src/core/account_storage.rs +++ b/src-tauri/src/core/account_storage.rs @@ -5,19 +5,12 @@ use std::path::PathBuf; /// Stored account data for persistence #[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Default)] pub struct AccountStore { pub accounts: Vec, pub active_account_id: Option, } -impl Default for AccountStore { - fn default() -> Self { - Self { - accounts: Vec::new(), - active_account_id: None, - } - } -} #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(tag = "type")] diff --git a/src-tauri/src/core/auth.rs b/src-tauri/src/core/auth.rs index e53c00e..5f01a58 100644 --- a/src-tauri/src/core/auth.rs +++ b/src-tauri/src/core/auth.rs @@ -115,7 +115,7 @@ pub async fn refresh_microsoft_token(refresh_token: &str) -> Result Result { let resp = client .post(url) .header("Content-Type", "application/x-www-form-urlencoded") - .body(serde_urlencoded::to_string(¶ms).map_err(|e| e.to_string())?) + .body(serde_urlencoded::to_string(params).map_err(|e| e.to_string())?) .send() .await .map_err(|e| e.to_string())?; @@ -261,7 +261,7 @@ pub async fn exchange_code_for_token(device_code: &str) -> Result>, } +impl Default for MsRefreshTokenState { + fn default() -> Self { + Self::new() + } +} + impl MsRefreshTokenState { pub fn new() -> Self { Self { -- cgit v1.2.3-70-g09d2