style: fix clippy warnings in live.rs and tray.rs

This commit is contained in:
YoVinchen
2026-03-29 21:47:17 +08:00
parent cc070327ff
commit dbb943852d
7 changed files with 23 additions and 26 deletions
+2 -2
View File
@@ -22,10 +22,10 @@ pub mod skill;
mod stream_check;
mod sync_support;
mod lightweight;
mod usage;
mod webdav_sync;
mod workspace;
mod lightweight;
pub use auth::*;
pub use config::*;
@@ -48,7 +48,7 @@ pub use settings::*;
pub use skill::*;
pub use stream_check::*;
pub use lightweight::*;
pub use usage::*;
pub use webdav_sync::*;
pub use workspace::*;
pub use lightweight::*;
+1 -1
View File
@@ -87,4 +87,4 @@ pub fn exit_lightweight_mode(app: &tauri::AppHandle) -> Result<(), String> {
pub fn is_lightweight_mode() -> bool {
LIGHTWEIGHT_MODE.load(Ordering::Acquire)
}
}
+2 -4
View File
@@ -39,11 +39,9 @@ pub(crate) fn provider_exists_in_live_config(
) -> Result<bool, AppError> {
match app_type {
AppType::OpenCode => crate::opencode_config::get_providers()
.map(|providers| providers.contains_key(provider_id))
.map_err(Into::into),
.map(|providers| providers.contains_key(provider_id)),
AppType::OpenClaw => crate::openclaw_config::get_providers()
.map(|providers| providers.contains_key(provider_id))
.map_err(Into::into),
.map(|providers| providers.contains_key(provider_id)),
_ => Ok(false),
}
}
+5 -8
View File
@@ -393,11 +393,10 @@ pub fn create_tray_menu(
true,
crate::lightweight::is_lightweight_mode(),
None::<&str>,
).map_err(|e| AppError::Message(format!("创建轻量模式菜单失败: {e}")))?;
)
.map_err(|e| AppError::Message(format!("创建轻量模式菜单失败: {e}")))?;
menu_builder = menu_builder
.item(&lightweight_item)
.separator();
menu_builder = menu_builder.item(&lightweight_item).separator();
// 退出菜单(分隔符已在上面的 section 循环中添加)
let quit_item = MenuItem::with_id(app, "quit", tray_texts.quit, true, None::<&str>)
@@ -472,10 +471,8 @@ pub fn handle_tray_menu_event(app: &tauri::AppHandle, event_id: &str) {
if let Err(e) = crate::lightweight::exit_lightweight_mode(app) {
log::error!("退出轻量模式失败: {e}");
}
} else {
if let Err(e) = crate::lightweight::enter_lightweight_mode(app) {
log::error!("进入轻量模式失败: {e}");
}
} else if let Err(e) = crate::lightweight::enter_lightweight_mode(app) {
log::error!("进入轻量模式失败: {e}");
}
}
"quit" => {