chore: cargo clippy --fix 自动清理小手术 (closes #170)

cargo clippy --fix 自动修了 8 个 lint,warnings 从 18 降到 16。

改动文件:
- asr/mod.rs / coordinator.rs / hotkey.rs / insertion.rs / polish.rs / types.rs
- 主要是 needless_borrow / single_match / useless_conversion / 多余 cast

build 跑过:
- cargo check ✅
- npm run build ✅

剩余 16 个 warning 都是有意保留的(test-only helpers、future-API placeholder、
类似 TodayMetrics 这种历史接口),不动这些避免破坏 surface。issue #170
里更深层的整洁度(SettingsWriter dedupe / force 参数删除等)后续 PR 跟进。
This commit is contained in:
baiqing committed 2026-05-02 10:24:21 +08:00
1 parent 68298d253c
commit 6fde92417b
6 files changed
+8 -14

No files matched your search

+1 -1
View File
@@ -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.
@@ -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<R: tauri::Runtime>(
if crate::position_capsule_bottom_center(window, translation_active).is_ok() {
let mut last = inner.capsule_layout.lock();
*last = Some(next);
return;
}
}
+1 -1
View File
@@ -164,7 +164,7 @@ mod platform {
"hotkey hook 启动超时",
run_listen_loop,
)?;
let _ = listener.startup;
listener.startup;
Ok(Box::new(MacHotkeyAdapter {
shared: listener.shared,
}))
@@ -10,7 +10,6 @@
//! → CGEventPost,跟我们这里完全同源。
//! 3. 其他平台 (Windows/Linux) 仍用 enigo。
use std::time::Duration;
use crate::types::InsertStatus;
+1 -2
View File
@@ -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();
+4 -7
View File
@@ -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")]