mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 08:45:41 +08:00
fix(clippy): clippy warning codes
This commit is contained in:
@@ -576,9 +576,11 @@ impl CoreManager {
|
||||
// 安装失败,记录错误并使用sidecar模式
|
||||
logging!(warn, Type::Core, true, "服务安装失败: {}", err);
|
||||
|
||||
let mut new_state = service::ServiceState::default();
|
||||
new_state.last_error = Some(err.to_string());
|
||||
new_state.prefer_sidecar = true; // 标记偏好sidecar模式
|
||||
let new_state = service::ServiceState {
|
||||
last_error: Some(err.to_string()),
|
||||
prefer_sidecar: true,
|
||||
..Default::default()
|
||||
};
|
||||
new_state.save()?;
|
||||
|
||||
self.start_core_by_sidecar().await?;
|
||||
|
||||
@@ -50,7 +50,7 @@ pub struct Tray {}
|
||||
impl TrayState {
|
||||
pub fn get_common_tray_icon() -> (bool, Vec<u8>) {
|
||||
let verge = Config::verge().latest().clone();
|
||||
let is_common_tray_icon = verge.common_tray_icon.clone().unwrap_or(false);
|
||||
let is_common_tray_icon = verge.common_tray_icon.unwrap_or(false);
|
||||
if is_common_tray_icon {
|
||||
if let Some(common_icon_path) = find_target_icons("common").unwrap() {
|
||||
let icon_data = fs::read(common_icon_path).unwrap();
|
||||
@@ -59,7 +59,7 @@ impl TrayState {
|
||||
}
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
let tray_icon_colorful = verge.tray_icon.clone().unwrap_or("monochrome".to_string());
|
||||
let tray_icon_colorful = verge.tray_icon.unwrap_or("monochrome".to_string());
|
||||
if tray_icon_colorful == "monochrome" {
|
||||
(
|
||||
false,
|
||||
@@ -84,7 +84,7 @@ impl TrayState {
|
||||
|
||||
pub fn get_sysproxy_tray_icon() -> (bool, Vec<u8>) {
|
||||
let verge = Config::verge().latest().clone();
|
||||
let is_sysproxy_tray_icon = verge.sysproxy_tray_icon.clone().unwrap_or(false);
|
||||
let is_sysproxy_tray_icon = verge.sysproxy_tray_icon.unwrap_or(false);
|
||||
if is_sysproxy_tray_icon {
|
||||
if let Some(sysproxy_icon_path) = find_target_icons("sysproxy").unwrap() {
|
||||
let icon_data = fs::read(sysproxy_icon_path).unwrap();
|
||||
@@ -118,7 +118,7 @@ impl TrayState {
|
||||
|
||||
pub fn get_tun_tray_icon() -> (bool, Vec<u8>) {
|
||||
let verge = Config::verge().latest().clone();
|
||||
let is_tun_tray_icon = verge.tun_tray_icon.clone().unwrap_or(false);
|
||||
let is_tun_tray_icon = verge.tun_tray_icon.unwrap_or(false);
|
||||
if is_tun_tray_icon {
|
||||
if let Some(tun_icon_path) = find_target_icons("tun").unwrap() {
|
||||
let icon_data = fs::read(tun_icon_path).unwrap();
|
||||
|
||||
@@ -76,10 +76,10 @@ impl SpeedRate {
|
||||
}
|
||||
|
||||
// 分离图标加载和速率渲染
|
||||
pub fn add_speed_text<'a>(
|
||||
pub fn add_speed_text(
|
||||
is_custom_icon: bool,
|
||||
icon_bytes: Option<Vec<u8>>,
|
||||
rate: Option<&'a Rate>,
|
||||
rate: Option<&Rate>,
|
||||
) -> Result<Vec<u8>> {
|
||||
let rate = rate.unwrap_or(&Rate { up: 0, down: 0 });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user