Skip to content

Commit b129311

Browse files
committed
style: fix clippy error
1 parent 092cab2 commit b129311

File tree

3 files changed

+17
-20
lines changed

3 files changed

+17
-20
lines changed

src-tauri/src/cmd/config.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,10 @@ pub async fn save_settings_and_restart(
7676
Some(settings.openlist.data_dir.as_str())
7777
};
7878
update_data_config(settings.openlist.port, data_dir)?;
79-
match get_openlist_core_process_status().await {
80-
Ok(info) => {
81-
if info.is_running {
82-
restart_openlist_core(state.clone()).await?;
83-
}
79+
if let Ok(info) = get_openlist_core_process_status().await {
80+
if info.is_running {
81+
restart_openlist_core(state.clone()).await?;
8482
}
85-
Err(_) => {}
8683
}
8784
Ok(true)
8885
}

src-tauri/src/core/process_manager.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,10 @@ impl ProcessManager {
228228
) -> Option<u32> {
229229
let sys_old_pid = sysinfo::Pid::from(old_pid as usize);
230230

231-
if let Some(proc) = sys.process(sys_old_pid) {
232-
if self.is_cmd_match(proc, expected_cmd, expected_args) {
233-
return Some(old_pid);
234-
}
231+
if let Some(proc) = sys.process(sys_old_pid)
232+
&& self.is_cmd_match(proc, expected_cmd, expected_args)
233+
{
234+
return Some(old_pid);
235235
}
236236

237237
for (pid, proc) in sys.processes() {
@@ -276,10 +276,10 @@ impl ProcessManager {
276276
let normalized_actual = actual_arg_str.replace("\\\\", "\\");
277277
let normalized_expected = expected_arg.replace("\\\\", "\\");
278278

279-
if normalized_actual != normalized_expected {
280-
if !normalized_actual.contains(&normalized_expected) {
281-
return false;
282-
}
279+
if normalized_actual != normalized_expected
280+
&& !normalized_actual.contains(&normalized_expected)
281+
{
282+
return false;
283283
}
284284
}
285285

src-tauri/src/tray.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ async fn handle_menu_event(app: &AppHandle, id: &str) -> Result<(), String> {
110110
ID_QUIT => app.exit(0),
111111
ID_RESTART_APP => app.restart(),
112112
ID_SHOW => {
113-
get_main_window(app).map(|w| {
114-
let _ = w.show();
115-
let _ = w.set_focus();
116-
});
113+
if let Some(window) = get_main_window(app) {
114+
let _ = window.show();
115+
let _ = window.set_focus();
116+
}
117117
}
118118
ID_HIDE => {
119-
get_main_window(app).map(|w| {
119+
if let Some(w) = get_main_window(app) {
120120
let _ = w.hide();
121-
});
121+
}
122122
}
123123
ID_SERVICE_START | ID_SERVICE_STOP | ID_SERVICE_RESTART => {
124124
let action = id.replace("_service", "");

0 commit comments

Comments
 (0)