Skip to content

Commit c734522

Browse files
committed
chore: cargo fmt
1 parent ec039b9 commit c734522

2 files changed

Lines changed: 9 additions & 18 deletions

File tree

‎src-tauri/src/main.rs‎

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
22
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
33

4-
use std::path::PathBuf;
5-
use std::sync::{Arc, Mutex, OnceLock, Condvar};
64
use lazy_static::lazy_static;
5+
use std::path::PathBuf;
6+
use std::sync::{Arc, Condvar, Mutex, OnceLock};
77

88
use tauri::Manager;
99
use tauri::SystemTray;
@@ -16,9 +16,7 @@ mod manager;
1616

1717
static HANDLE: OnceLock<Mutex<AppHandle>> = OnceLock::new();
1818
lazy_static! {
19-
static ref SHARED_CONDVAR: (Mutex<bool>, Condvar) = {
20-
(Mutex::new(false), Condvar::new())
21-
};
19+
static ref SHARED_CONDVAR: (Mutex<bool>, Condvar) = { (Mutex::new(false), Condvar::new()) };
2220
}
2321

2422
fn init_app_handle(handle: AppHandle) {
@@ -83,13 +81,7 @@ fn main() {
8381
Ok(())
8482
})
8583
.system_tray(tray)
86-
.on_system_tray_event(move |app, event| {
87-
on_tray_event(
88-
app,
89-
event,
90-
&manager_state,
91-
)
92-
})
84+
.on_system_tray_event(move |app, event| on_tray_event(app, event, &manager_state))
9385
.on_window_event(|event| match event.event() {
9486
tauri::WindowEvent::CloseRequested { api, .. } => {
9587
event.window().hide().unwrap();

‎src-tauri/src/manager.rs‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,16 @@ impl ManagerState {
8686
.add_native_item(SystemTrayMenuItem::Separator)
8787
.add_item(quit);
8888

89-
let &(ref lock, ref cvar) = &*SHARED_CONDVAR;
90-
let mut state = lock.lock().unwrap();
89+
let &(ref lock, ref cvar) = &*SHARED_CONDVAR;
90+
let mut state = lock.lock().unwrap();
9191

92-
while ! *state {
93-
state = cvar.wait(state).unwrap();
94-
}
92+
while !*state {
93+
state = cvar.wait(state).unwrap();
94+
}
9595

9696
let app = get_app_handle().lock().expect("failed to get app handle");
9797
let tray_handle = app.tray_handle();
9898
tray_handle.set_menu(menu).expect("failed to set tray menu");
99-
10099
}
101100
pub fn stop_watchers(&mut self) {
102101
for (name, pid) in self.watchers_pid.iter() {

0 commit comments

Comments
 (0)