refactor: 删除无调用点的死代码(审计项)

- src/parse/mod.rs: parse_italic_assign(17 行,0 引用)
- src/host/sandbox_fs.rs: unavailable
- src/knowledge/extract.rs: stem_of
- src/knowledge/lifecycle.rs: _system_time_now
- src/debug/ctrl.rs: action_channel
- 连带清理 3 处随之失效的 import

cargo build 零警告;cargo test --release 605 passed / 0 failed。
src 行数 53,079 → 52,96x。
This commit is contained in:
cflmy committed 2026-10-22 15:40:31 +08:00
1 parent 8b0ea9ed7a
commit a14a6e221d
5 files changed
+1 -40

No files matched your search

-7
View File
@@ -2,7 +2,6 @@
use std::collections::{HashMap, HashSet};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::mpsc::{self, Receiver, Sender};
use std::sync::{Arc, Condvar, Mutex};
use std::time::Duration;
@@ -237,12 +236,6 @@ pub fn snapshot_json(s: &DebugSnapshot) -> serde_json::Value {
}
}
/// Channel pair helper if needed by callers.
#[allow(dead_code)]
pub fn action_channel() -> (Sender<DebugAction>, Receiver<DebugAction>) {
mpsc::channel()
}
#[cfg(test)]
mod tests {
use super::*;
-5
View File
@@ -456,11 +456,6 @@ pub fn query(name: &str, args: &serde_json::Value, ctx: &HostContext) -> Result<
}
}
#[allow(dead_code)]
pub fn unavailable(feature: &str) -> String {
format!("{feature} unavailable in sandbox")
}
/// Used by fs layer when session is active — map Value path through resolve then CoW.
pub fn try_read_value(ctx: &HostContext, path: &Value) -> Result<Option<Value>, String> {
let rel = match path {
+1 -5
View File
@@ -13,7 +13,7 @@ use crate::knowledge::ir::{
};
use crate::knowledge::util::{
extract_fm_field, extract_fm_list, extract_nested_by, extract_section, first_paragraph,
module_stem, slugify,
slugify,
};
use crate::lex::{classify_source, LineKind};
use crate::parse::parse_source;
@@ -522,7 +522,3 @@ fn extract_frontmatter_imports(source: &str) -> Vec<String> {
imports
}
#[allow(dead_code)]
pub fn stem_of(resource: &str) -> String {
module_stem(resource)
}
-5
View File
@@ -2,7 +2,6 @@
use std::fs;
use std::path::Path;
use std::time::SystemTime;
use serde_json::{json, Value};
@@ -248,7 +247,3 @@ pub fn verify_json(issues: &[VerifyIssue]) -> Value {
})
}
#[allow(dead_code)]
fn _system_time_now() -> SystemTime {
SystemTime::now()
}
-18
View File
@@ -554,24 +554,6 @@ impl<'a> Cursor<'a> {
bail!("{span}: bold code must be assignment, call, or expression (got `{inner}`)");
}
#[allow(dead_code)]
fn parse_italic_assign(&mut self, inner: &str, span: Span) -> Result<Stmt> {
// Kept for unit tests migrating; v0.3 uses bold for assign.
let Some((name, rhs)) = split_assign_inner(inner) else {
bail!("{span}: assignment must be name = …");
};
if crate::aliases::is_reserved_keyword(&name) {
bail!("{span}: `{name}` is a reserved keyword");
}
let (value, end_line) = self.resolve_assign_rhs(&name, &rhs, span, true)?;
Ok(Stmt::Assign {
name,
value,
span,
end_line,
})
}
fn parse_backtick_assign(&mut self, trimmed: &str, span: Span) -> Result<Option<Stmt>> {
// `name` = [rhs]
let Some(rest) = trimmed.strip_prefix('`') else {