Skip to content

Commit a855cbc

Browse files
committed
chore(review): 编译器警告清零(死代码登记/未用导入/括号与 mut)
1 parent ef0a1ec commit a855cbc

13 files changed

Lines changed: 16 additions & 19 deletions

‎app/src-tauri/src/ai_proofread.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub const SENTENCE_MAX_CHARS: usize = 120;
4545
pub fn split_sentences(text: &str) -> Vec<String> {
4646
let mut out = Vec::new();
4747
let mut buf: Vec<char> = Vec::new();
48-
let mut flush = |buf: &mut Vec<char>, out: &mut Vec<String>| {
48+
let flush = |buf: &mut Vec<char>, out: &mut Vec<String>| {
4949
let s: String = buf.iter().collect::<String>().trim().to_string();
5050
let len = s.chars().count();
5151
if (SENTENCE_MIN_CHARS..=SENTENCE_MAX_CHARS).contains(&len) {
@@ -77,7 +77,7 @@ pub fn chunk_sentences(sentences: &[String]) -> Vec<Vec<usize>> {
7777
let mut cur_chars = 0usize;
7878
for (i, s) in sentences.iter().enumerate() {
7979
let len = s.chars().count() + 4; // 编号 + 换行开销
80-
if (!cur.is_empty() && (cur.len() >= MAX_SENTENCES_PER_CHUNK || cur_chars + len > CHUNK_MAX_CHARS))
80+
if !cur.is_empty() && (cur.len() >= MAX_SENTENCES_PER_CHUNK || cur_chars + len > CHUNK_MAX_CHARS)
8181
{
8282
chunks.push(std::mem::take(&mut cur));
8383
cur_chars = 0;

‎app/src-tauri/src/asr_confusion.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ fn word_pairs(old: &str, new: &str) -> Vec<(String, String)> {
180180
let mut out = Vec::new();
181181
let mut run_old: Vec<char> = Vec::new();
182182
let mut run_new: Vec<char> = Vec::new();
183-
let mut flush = |run_old: &mut Vec<char>, run_new: &mut Vec<char>, out: &mut Vec<(String, String)>| {
183+
let flush = |run_old: &mut Vec<char>, run_new: &mut Vec<char>, out: &mut Vec<(String, String)>| {
184184
if !run_old.is_empty()
185185
&& !run_new.is_empty()
186186
&& run_old.len() == run_new.len()

‎app/src-tauri/src/commands_session_note.rs‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,11 +300,9 @@ pub async fn session_to_note(
300300
inner
301301
}
302302

303-
/// 批量转笔记核心编排(v0.7.1:部分成功语义——单条失败不阻塞其他)。
304-
///
305-
/// @ai-context: 纯编排纯函数(注入 Db + UiJunkList,无 Tauri 依赖,可单测);
306-
/// 跳过规则显式回传原因(不静默):无效 id / 进行中 / 已转 / 会话不存在;
307-
/// DB 读错误视为硬失败中止(库损坏时继续处理无意义)。
303+
/// 批量转笔记核心编排外壳(仅测试基准——命令入口走
304+
/// run_batch_conversion_inner(REQ-269 规则注入),外壳保持既有测试签名)。
305+
#[cfg(test)]
308306
pub fn run_batch_conversion(
309307
db: &Db,
310308
ui_junk: &UiJunkList,

‎app/src-tauri/src/commands_sop.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use tauri::State;
1010

1111
use crate::commands::AppState;
1212
use crate::db_sop::{
13-
lines_to_steps, EVIDENCE_PREFIX, MAX_SOP_STEPS, MODE_CONFIRM, MODE_READDO, RUN_ABORTED,
13+
lines_to_steps, EVIDENCE_PREFIX, MAX_SOP_STEPS, MODE_READDO, RUN_ABORTED,
1414
RUN_DONE, SopRunDetail, SopTemplate,
1515
};
1616

‎app/src-tauri/src/commands_tasks.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ pub fn completion_history_list(
214214
}
215215

216216
/// 占位导出(todo.txt 行文本——REQ-295 保底三件套的「复制」面由前端剪贴板完成)。
217+
#[allow(dead_code)] // 文件导出由前端拼接行内容(保底通道)——本纯函数留作校验/复现用
217218
pub fn export_todotxt_lines(rows: &[ActionQueueRow]) -> String {
218219
rows.iter()
219220
.map(|r| format!("[ ] {} (via:{})", r.text, r.note_title))

‎app/src-tauri/src/commands_web_inbox.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
//! 载荷白名单校验(web_inbox::validate_payload)、体量上限;
1111
//! 服务仅应用运行期有效(进程退出即停)——无驻留后门。
1212
13-
use serde::{Deserialize, Serialize};
13+
use serde::Serialize;
1414
use std::collections::HashMap;
1515
use std::io::{Read, Write};
1616
use std::net::{TcpListener, TcpStream};
1717
use std::sync::atomic::{AtomicBool, Ordering};
18-
use std::sync::{Arc, Mutex};
18+
use std::sync::Arc;
1919
use std::time::{SystemTime, UNIX_EPOCH};
2020
use tauri::State;
2121

‎app/src-tauri/src/db_completion.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use crate::error::Result;
1515
/// 事件类型。
1616
pub const EV_DONE: &str = "done";
1717
pub const EV_ABANDONED: &str = "abandoned";
18+
#[allow(dead_code)] // 迁出事件由 export 复制/文件路径产生(meta 通道),常量预留给通道扩展
1819
pub const EV_EXPORTED: &str = "exported";
1920
pub const EV_EXPORT_MANUAL_DONE: &str = "export_manual_done";
2021
pub const EV_PRACTICE_TICK: &str = "practice_tick";

‎app/src-tauri/src/db_practice.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ impl Db {
137137
})
138138
}
139139

140+
#[allow(dead_code)] // 停用/归档命令面未接线(登记:UI 操作列后置)
140141
pub fn set_practice_status(&self, item_id: i64, status: &str) -> Result<bool> {
141142
if !matches!(status, ITEM_ACTIVE | ITEM_PAUSED | ITEM_ARCHIVED) {
142143
return Err(crate::error::AppError::Asr("非法条目状态".to_string()));

‎app/src-tauri/src/db_sop.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use crate::error::Result;
1717

1818
pub const MODE_READDO: &str = "readdo";
1919
pub const MODE_CONFIRM: &str = "confirm";
20+
#[allow(dead_code)] // 与命令层字面量同值——保留为常量(防双处漂移),接入点登记
2021
pub const RUN_ACTIVE: &str = "active";
2122
pub const RUN_DONE: &str = "done";
2223
pub const RUN_ABORTED: &str = "aborted";

‎app/src-tauri/src/db_task_index.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ impl Db {
151151
}
152152

153153
/// 索引列纠偏(learning|practice|sop|export——提炼/裁决时标注)。
154+
#[allow(dead_code)] // 纠偏命令面未接线(登记:disposition 标注随提炼/裁决 UI 后置)
154155
pub fn set_task_disposition(
155156
&self,
156157
row_id: i64,

0 commit comments

Comments
 (0)