diff --git a/openless-all/app/src-tauri/src/asr/mod.rs b/openless-all/app/src-tauri/src/asr/mod.rs index deacf2e0..419de904 100644 --- a/openless-all/app/src-tauri/src/asr/mod.rs +++ b/openless-all/app/src-tauri/src/asr/mod.rs @@ -9,7 +9,7 @@ mod frame; pub mod volcengine; pub mod whisper; -pub use volcengine::{VolcengineASRError, VolcengineCredentials, VolcengineStreamingASR}; +pub use volcengine::{VolcengineCredentials, VolcengineStreamingASR}; pub use whisper::WhisperBatchASR; /// Sink for raw 16 kHz / 16-bit / mono PCM bytes coming off the recorder. diff --git a/openless-all/app/src-tauri/src/coordinator.rs b/openless-all/app/src-tauri/src/coordinator.rs index 51bb0c42..98c25487 100644 --- a/openless-all/app/src-tauri/src/coordinator.rs +++ b/openless-all/app/src-tauri/src/coordinator.rs @@ -749,7 +749,7 @@ async fn handle_window_hotkey_event( #[cfg(not(target_os = "windows"))] { let _ = (inner, event_type, key, code, repeat); - return Ok(()); + Ok(()) } #[cfg(target_os = "windows")] @@ -2599,7 +2599,6 @@ fn maybe_position_capsule_bottom_center( if crate::position_capsule_bottom_center(window, translation_active).is_ok() { let mut last = inner.capsule_layout.lock(); *last = Some(next); - return; } } diff --git a/openless-all/app/src-tauri/src/hotkey.rs b/openless-all/app/src-tauri/src/hotkey.rs index 8eb27b25..97430e9f 100644 --- a/openless-all/app/src-tauri/src/hotkey.rs +++ b/openless-all/app/src-tauri/src/hotkey.rs @@ -164,7 +164,7 @@ mod platform { "hotkey hook 启动超时", run_listen_loop, )?; - let _ = listener.startup; + listener.startup; Ok(Box::new(MacHotkeyAdapter { shared: listener.shared, })) diff --git a/openless-all/app/src-tauri/src/insertion.rs b/openless-all/app/src-tauri/src/insertion.rs index 79ad95d5..51074a8c 100644 --- a/openless-all/app/src-tauri/src/insertion.rs +++ b/openless-all/app/src-tauri/src/insertion.rs @@ -10,6 +10,7 @@ //! → CGEventPost,跟我们这里完全同源。 //! 3. 其他平台 (Windows/Linux) 仍用 enigo。 +#[cfg(not(target_os = "macos"))] use std::time::Duration; use crate::types::InsertStatus; diff --git a/openless-all/app/src-tauri/src/polish.rs b/openless-all/app/src-tauri/src/polish.rs index d207bf33..aaf68c57 100644 --- a/openless-all/app/src-tauri/src/polish.rs +++ b/openless-all/app/src-tauri/src/polish.rs @@ -606,10 +606,9 @@ const BOILERPLATE_END_CHARS: &[char] = &['。', ':', ':', ',', ',', '\n']; fn strip_leading_boilerplate(text: &str) -> &str { for prefix in LEADING_BOILERPLATE_PREFIXES { - if text.starts_with(prefix) { + if let Some(after_prefix) = text.strip_prefix(prefix) { // Trim characters after the prefix up to (and including) the first // sentence-ending punctuation or newline. - let after_prefix = &text[prefix.len()..]; for (idx, c) in after_prefix.char_indices() { if BOILERPLATE_END_CHARS.contains(&c) { let cut = prefix.len() + idx + c.len_utf8(); diff --git a/openless-all/app/src-tauri/src/types.rs b/openless-all/app/src-tauri/src/types.rs index b12e1d62..f4a4a9b6 100644 --- a/openless-all/app/src-tauri/src/types.rs +++ b/openless-all/app/src-tauri/src/types.rs @@ -4,18 +4,15 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)] #[serde(rename_all = "lowercase")] +#[derive(Default)] pub enum PolishMode { Raw, + #[default] Light, Structured, Formal, } -impl Default for PolishMode { - fn default() -> Self { - PolishMode::Light - } -} impl PolishMode { pub fn display_name(&self) -> &'static str { @@ -300,7 +297,7 @@ impl HotkeyCapability { pub fn current() -> Self { #[cfg(target_os = "macos")] { - return Self { + Self { adapter: HotkeyAdapterKind::MacEventTap, available_triggers: vec![ HotkeyTrigger::RightOption, @@ -315,7 +312,7 @@ impl HotkeyCapability { supports_side_specific_modifiers: true, explicit_fallback_available: false, status_hint: Some("授权辅助功能后,通常需要完全退出并重新打开 OpenLess。".into()), - }; + } } #[cfg(target_os = "windows")]