Skip to content

Commit

Permalink
chore: eliminate the warning of wrap_err!
Browse files Browse the repository at this point in the history
Signed-off-by: The1111mp <[email protected]>
  • Loading branch information
1111mp committed Oct 12, 2024
1 parent 9768a0a commit 991443f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src-tauri/src/cmds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down
4 changes: 2 additions & 2 deletions src-tauri/src/core/configration.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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", ())?;
}
Expand Down
5 changes: 2 additions & 3 deletions src-tauri/src/core/group.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::{
config::{Config, Group},
utils::{dirs, help},
config::{Config, Group}, log_err, utils::{dirs, help}
};
use anyhow::Result;

Expand Down Expand Up @@ -29,7 +28,7 @@ pub async fn update_groups(list: Vec<Group>) -> Result<()> {
Config::groups().apply();
Config::groups().data().save_file()?;

handle::Handle::update_systray_part()?;
log_err!(handle::Handle::update_systray_part());

Ok(())
}
Expand Down
10 changes: 4 additions & 6 deletions src-tauri/src/core/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Arc<Mutex<Option<watch::Sender<bool>>>>> =
Expand Down Expand Up @@ -55,7 +55,7 @@ pub async fn set_current(version: Option<String>) -> Result<()> {
Config::node().apply();
Config::node().data().save_current()?;

handle::Handle::update_systray_part()?;
log_err!(handle::Handle::update_systray_part());

Ok(())
}
Expand All @@ -64,12 +64,10 @@ pub async fn set_current(version: Option<String>) -> Result<()> {
pub async fn update_current_from_menu(current: String) -> Result<()> {
let ret = {
Config::node().draft().update_current(&current)?;

wrap_err!(handle::Handle::update_systray_part_with_emit(
log_err!(handle::Handle::update_systray_part_with_emit(
"call-current-update",
&current
));

<Result<()>>::Ok(())
};

Expand Down Expand Up @@ -159,7 +157,7 @@ pub async fn get_installed_list(fetch: Option<bool>) -> Result<Option<Vec<String

// update system tray
if list.len() != versions.len() {
handle::Handle::update_systray_part()?;
log_err!(handle::Handle::update_systray_part());
}

Ok(Some(versions))
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/src/core/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub async fn update_projects(list: Vec<Project>, path: Option<PathBuf>) -> Resul
Config::projects().apply();
Config::projects().data().save_file()?;

handle::Handle::update_systray_part()?;
log_err!(handle::Handle::update_systray_part());

Ok(())
}
Expand Down

0 comments on commit 991443f

Please sign in to comment.