fix: cargo clippy errors

This commit is contained in:
Tunglies 2025-04-21 00:06:37 +08:00
parent c7494de0a7
commit 07b424cb09
3 changed files with 22 additions and 19 deletions

View File

@ -1,9 +1,11 @@
#[cfg(target_os = "windows")]
use crate::utils::autostart as startup_shortcut;
use crate::{ use crate::{
config::{Config, IVerge}, config::{Config, IVerge},
core::handle::Handle, core::handle::Handle,
logging, logging_error, logging, logging_error,
process::AsyncHandler, process::AsyncHandler,
utils::{autostart as startup_shortcut, logging::Type}, utils::logging::Type,
}; };
use anyhow::Result; use anyhow::Result;
use once_cell::sync::OnceCell; use once_cell::sync::OnceCell;
@ -363,7 +365,7 @@ impl Sysopt {
} else { } else {
let sysproxy = Sysproxy { let sysproxy = Sysproxy {
enable: true, enable: true,
host: proxy_host.into(), host: proxy_host,
port, port,
bypass: get_bypass(), bypass: get_bypass(),
}; };

View File

@ -19,7 +19,6 @@ use tauri::AppHandle;
use tauri::Manager; use tauri::Manager;
use tauri_plugin_autostart::MacosLauncher; use tauri_plugin_autostart::MacosLauncher;
use tauri_plugin_deep_link::DeepLinkExt; use tauri_plugin_deep_link::DeepLinkExt;
use tauri_plugin_window_state;
use utils::logging::Type; use utils::logging::Type;
/// A global singleton handle to the application. /// A global singleton handle to the application.

View File

@ -1,9 +1,10 @@
#[cfg(target_os = "windows")]
use anyhow::{anyhow, Result}; use anyhow::{anyhow, Result};
#[cfg(target_os = "windows")]
use log::info; use log::info;
use std::{
fs, #[cfg(target_os = "windows")]
path::{Path, PathBuf}, use std::{fs, path::Path, path::PathBuf};
};
/// Windows 下的开机启动文件夹路径 /// Windows 下的开机启动文件夹路径
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
@ -25,6 +26,7 @@ pub fn get_startup_dir() -> Result<PathBuf> {
} }
/// 获取当前可执行文件路径 /// 获取当前可执行文件路径
#[cfg(target_os = "windows")]
pub fn get_exe_path() -> Result<PathBuf> { pub fn get_exe_path() -> Result<PathBuf> {
let exe_path = let exe_path =
std::env::current_exe().map_err(|e| anyhow!("无法获取当前可执行文件路径: {}", e))?; std::env::current_exe().map_err(|e| anyhow!("无法获取当前可执行文件路径: {}", e))?;
@ -98,17 +100,17 @@ pub fn is_shortcut_enabled() -> Result<bool> {
} }
// 非 Windows 平台使用的空方法 // 非 Windows 平台使用的空方法
#[cfg(not(target_os = "windows"))] // #[cfg(not(target_os = "windows"))]
pub fn create_shortcut() -> Result<()> { // pub fn create_shortcut() -> Result<()> {
Ok(()) // Ok(())
} // }
#[cfg(not(target_os = "windows"))] // #[cfg(not(target_os = "windows"))]
pub fn remove_shortcut() -> Result<()> { // pub fn remove_shortcut() -> Result<()> {
Ok(()) // Ok(())
} // }
#[cfg(not(target_os = "windows"))] // #[cfg(not(target_os = "windows"))]
pub fn is_shortcut_enabled() -> Result<bool> { // pub fn is_shortcut_enabled() -> Result<bool> {
Ok(false) // Ok(false)
} // }