Skip to content

Commit

Permalink
Fix lint and cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Misieq01 committed Sep 19, 2024
1 parent 25cb963 commit fcf0a64
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src-tauri/src/binary_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::download_utils::{download_file_with_retries, extract, validate_checks
use crate::{github, ProgressTracker};
use anyhow::{anyhow, Error};
use async_trait::async_trait;
use log::{debug, error, info, warn};
use log::{debug, error, warn};
use regex::Regex;
use semver::{Version, VersionReq};
use std::collections::HashMap;
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/src/hardware_monitor.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{ops::Deref, sync::LazyLock};

use log::{debug, info, warn};
use log::{debug, warn};
use nvml_wrapper::{enum_wrappers::device::TemperatureSensor, Nvml};
use serde::Serialize;
use sysinfo::{Component, Components, CpuRefreshKind, RefreshKind, System};
Expand Down
7 changes: 2 additions & 5 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,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;
Expand All @@ -32,7 +33,6 @@ mod wallet_adapter;
mod wallet_manager;
mod xmrig;
mod xmrig_adapter;
mod notification_manager;

use crate::cpu_miner::CpuMiner;
use crate::gpu_miner::GpuMiner;
Expand Down Expand Up @@ -529,10 +529,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(())
}
Expand Down
24 changes: 10 additions & 14 deletions src-tauri/src/notification_manager.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::sync::LazyLock;
use notify_rust::Notification;
use std::sync::LazyLock;

use log::info;

Expand All @@ -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")]
Expand All @@ -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
Expand All @@ -75,4 +71,4 @@ impl NotificationManager {
pub fn current() -> &'static NotificationManager {
&INSTANCE
}
}
}

0 comments on commit fcf0a64

Please sign in to comment.