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::{
config::{Config, IVerge},
core::handle::Handle,
logging, logging_error,
process::AsyncHandler,
utils::{autostart as startup_shortcut, logging::Type},
utils::logging::Type,
};
use anyhow::Result;
use once_cell::sync::OnceCell;
@ -363,7 +365,7 @@ impl Sysopt {
} else {
let sysproxy = Sysproxy {
enable: true,
host: proxy_host.into(),
host: proxy_host,
port,
bypass: get_bypass(),
};

View File

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

View File

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