From 991443f710808af78ede2abb612058d9af41f2fd Mon Sep 17 00:00:00 2001 From: The1111mp Date: Sat, 12 Oct 2024 22:32:35 +0800 Subject: [PATCH] chore: eliminate the warning of `wrap_err!` Signed-off-by: The1111mp --- src-tauri/src/cmds.rs | 6 +++--- src-tauri/src/core/configration.rs | 4 ++-- src-tauri/src/core/group.rs | 5 ++--- src-tauri/src/core/node.rs | 10 ++++------ src-tauri/src/core/project.rs | 2 +- 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src-tauri/src/cmds.rs b/src-tauri/src/cmds.rs index 8966814..847e483 100644 --- a/src-tauri/src/cmds.rs +++ b/src-tauri/src/cmds.rs @@ -47,16 +47,16 @@ pub async fn update_settings(settings: ISettings) -> CmdResult<()> { let locale = Config::settings().latest().get_locale(); let directory = Config::settings().latest().get_directory(); - wrap_err!({ Config::settings().draft().patch_settings(settings.clone()) }); + wrap_err!({ Config::settings().draft().patch_settings(settings.clone()) })?; Config::settings().apply(); // refresh data when directory changes if directory != settings.directory { - wrap_err!(node::get_installed_list(Some(true)).await); + wrap_err!(node::get_installed_list(Some(true)).await)?; } // update system tray if locale != settings.locale || directory != settings.directory { - wrap_err!(handle::Handle::update_systray_part()); + wrap_err!(handle::Handle::update_systray_part())?; } Ok(()) diff --git a/src-tauri/src/core/configration.rs b/src-tauri/src/core/configration.rs index faed816..b6fb9d5 100644 --- a/src-tauri/src/core/configration.rs +++ b/src-tauri/src/core/configration.rs @@ -1,5 +1,5 @@ use super::{handle, project::sync_project_version}; -use crate::config::{Config, Group, ISettings, Project}; +use crate::{config::{Config, Group, ISettings, Project}, log_err}; use anyhow::{bail, Result}; use serde::{Deserialize, Serialize}; use std::path::PathBuf; @@ -141,7 +141,7 @@ pub async fn configration_import( } // update system tray & notification page refresh data if need_update_projects || need_update_groups { - handle::Handle::update_systray_part()?; + log_err!(handle::Handle::update_systray_part()); if let Some(window) = app_handle.get_webview_window("main") { window.emit("call-projects-update", ())?; } diff --git a/src-tauri/src/core/group.rs b/src-tauri/src/core/group.rs index 99c8469..dffa54a 100644 --- a/src-tauri/src/core/group.rs +++ b/src-tauri/src/core/group.rs @@ -1,6 +1,5 @@ use crate::{ - config::{Config, Group}, - utils::{dirs, help}, + config::{Config, Group}, log_err, utils::{dirs, help} }; use anyhow::Result; @@ -29,7 +28,7 @@ pub async fn update_groups(list: Vec) -> Result<()> { Config::groups().apply(); Config::groups().data().save_file()?; - handle::Handle::update_systray_part()?; + log_err!(handle::Handle::update_systray_part()); Ok(()) } diff --git a/src-tauri/src/core/node.rs b/src-tauri/src/core/node.rs index 71977a2..893d4ff 100644 --- a/src-tauri/src/core/node.rs +++ b/src-tauri/src/core/node.rs @@ -19,8 +19,8 @@ use version_compare::{compare, Cmp}; use crate::{ config::{Config, NVersion}, core::handle, + log_err, utils::dirs, - wrap_err, }; static CANCEL_SENDER: Lazy>>>> = @@ -55,7 +55,7 @@ pub async fn set_current(version: Option) -> Result<()> { Config::node().apply(); Config::node().data().save_current()?; - handle::Handle::update_systray_part()?; + log_err!(handle::Handle::update_systray_part()); Ok(()) } @@ -64,12 +64,10 @@ pub async fn set_current(version: Option) -> Result<()> { pub async fn update_current_from_menu(current: String) -> Result<()> { let ret = { Config::node().draft().update_current(¤t)?; - - wrap_err!(handle::Handle::update_systray_part_with_emit( + log_err!(handle::Handle::update_systray_part_with_emit( "call-current-update", ¤t )); - >::Ok(()) }; @@ -159,7 +157,7 @@ pub async fn get_installed_list(fetch: Option) -> Result, path: Option) -> Resul Config::projects().apply(); Config::projects().data().save_file()?; - handle::Handle::update_systray_part()?; + log_err!(handle::Handle::update_systray_part()); Ok(()) }