From d14bda7e7a5b2129b5f9ee3a5c4afd02ca68b188 Mon Sep 17 00:00:00 2001 From: huzibaca Date: Thu, 10 Oct 2024 18:40:39 +0800 Subject: [PATCH] chore: update --- src-tauri/src/core/sysopt.rs | 20 ++++++++++---------- src-tauri/src/enhance/tun.rs | 2 +- src-tauri/src/feat.rs | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src-tauri/src/core/sysopt.rs b/src-tauri/src/core/sysopt.rs index ab214fb..ce20e74 100644 --- a/src-tauri/src/core/sysopt.rs +++ b/src-tauri/src/core/sysopt.rs @@ -41,14 +41,14 @@ fn get_bypass() -> String { None => "".to_string(), }; - let bypass = if custom_bypass.is_empty() { + + if custom_bypass.is_empty() { DEFAULT_BYPASS.to_string() } else if use_default { format!("{},{}", DEFAULT_BYPASS, custom_bypass) } else { custom_bypass - }; - bypass + } } impl Sysopt { @@ -311,7 +311,7 @@ impl Sysopt { let sysproxy = Sysproxy::get_system_proxy(); let autoproxy = Autoproxy::get_auto_proxy(); - if !sysproxy.is_ok() || !autoproxy.is_ok() { + if sysproxy.is_err() || autoproxy.is_err() { log::error!(target: "app", "failed to get the system proxy"); continue; } @@ -367,23 +367,23 @@ impl Sysopt { let shell = app_handle.shell(); let output = if pac { let address = format!("http://{}:{}/pac", "127.0.0.1", pac_port); - let output = shell + + shell .command(sysproxy_exe.as_path().to_str().unwrap()) .args(["opac", address.as_str()]) .output() .await - .unwrap(); - output + .unwrap() } else { let address = format!("{}:{}", "127.0.0.1", port); let bypass = get_bypass(); - let output = shell + + shell .command(sysproxy_exe.as_path().to_str().unwrap()) .args(["global", address.as_str(), bypass.as_ref()]) .output() .await - .unwrap(); - output + .unwrap() }; if !output.status.success() { break; diff --git a/src-tauri/src/enhance/tun.rs b/src-tauri/src/enhance/tun.rs index 650ebd0..b532f91 100644 --- a/src-tauri/src/enhance/tun.rs +++ b/src-tauri/src/enhance/tun.rs @@ -26,5 +26,5 @@ pub async fn use_tun(mut config: Mapping) -> Mapping { }); revise!(tun_val, "enable", true); revise!(config, "tun", tun_val); - return config; + config } diff --git a/src-tauri/src/feat.rs b/src-tauri/src/feat.rs index 5975f69..b71a997 100644 --- a/src-tauri/src/feat.rs +++ b/src-tauri/src/feat.rs @@ -250,11 +250,11 @@ pub async fn patch_verge(patch: IVerge) -> Result<()> { Config::verge().apply(); Config::verge().data().save_file()?; - return Ok(()); + Ok(()) } Err(err) => { Config::verge().discard(); - return Err(err); + Err(err) } } }