From 8f14dbf4ad9c90804fc77fc2664f1c19af870805 Mon Sep 17 00:00:00 2001 From: Misieq01 Date: Thu, 19 Sep 2024 09:47:24 +0200 Subject: [PATCH] Fix lint and cargo fmt --- src-tauri/src/main.rs | 7 ++----- src-tauri/src/notification_manager.rs | 24 ++++++++++-------------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 6d14c9be6..54752cdb1 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -61,6 +61,7 @@ mod mm_proxy_manager; mod network_utils; mod node_adapter; mod node_manager; +mod notification_manager; mod p2pool; mod p2pool_adapter; mod p2pool_manager; @@ -78,7 +79,6 @@ mod wallet_adapter; mod wallet_manager; mod xmrig; mod xmrig_adapter; -mod notification_manager; const MAX_ACCEPTABLE_COMMAND_TIME: Duration = Duration::from_secs(1); @@ -712,10 +712,7 @@ async fn get_seed_words( } #[tauri::command] -async fn trigger_notification( - summary: &str, - body: &str, -) -> Result<(), String> { +async fn trigger_notification(summary: &str, body: &str) -> Result<(), String> { NotificationManager::current().trigger_notification(summary, body); Ok(()) } diff --git a/src-tauri/src/notification_manager.rs b/src-tauri/src/notification_manager.rs index 16ab874d2..2d943d016 100644 --- a/src-tauri/src/notification_manager.rs +++ b/src-tauri/src/notification_manager.rs @@ -1,5 +1,5 @@ -use std::sync::LazyLock; use notify_rust::Notification; +use std::sync::LazyLock; use log::info; @@ -26,11 +26,9 @@ impl NotificationManager { match Self::detect_current_os() { CurrentOperatingSystem::Linux => { #[cfg(target_os = "linux")] - notification.show().unwrap().on_close( - |notification| { - info!(target: LOG_TARGET, "Notification closed: {:?}", notification); - }, - ); + notification.show().unwrap().on_close(|notification| { + info!(target: LOG_TARGET, "Notification closed: {:?}", notification); + }); } CurrentOperatingSystem::MacOS => { #[cfg(target_os = "macos")] @@ -44,22 +42,20 @@ impl NotificationManager { } fn build_notification(&self, summary: &str, body: &str) -> Notification { - let mut notification = Notification::new() - .summary(summary) - .body(body).finalize(); + let mut notification = Notification::new().summary(summary).body(body).finalize(); match Self::detect_current_os() { CurrentOperatingSystem::Linux => { - return notification.auto_icon().appname("Tari Universe").finalize(); + notification.auto_icon().appname("Tari Universe").finalize() } CurrentOperatingSystem::MacOS => { - return notification.finalize(); + notification.finalize() } CurrentOperatingSystem::Windows => { - return notification.finalize(); + notification.finalize() + } } } - } fn detect_current_os() -> CurrentOperatingSystem { if cfg!(target_os = "windows") { CurrentOperatingSystem::Windows @@ -75,4 +71,4 @@ impl NotificationManager { pub fn current() -> &'static NotificationManager { &INSTANCE } -} \ No newline at end of file +}