chore(m135): 删掉死代码 launch::loader_label,修 M134 之后变假话的三处文档
M134 复审点名、且都在它 scope 外的收尾。 - `presenter/src/host/launch.rs::loader_label` 删除:全仓零调用点(唯一提及是 i18n 的一条注释),函数体逐字重复 `dto::LoaderKind::label()` 并硬编码「原版」—— 它既是第二份显示词表,又绕过 i18n;留着等于给下一个人示范「照这样写就行」。 随之无用的 `LoaderKind` import 一并收掉。 - `presenter/src/lib.rs` 的 dead_code 豁免说明不再点名已删函数(否则那行注释指向 一个不存在的符号)。 - `i18n/src/bridge.rs:65` 注释改指向唯一那份显示词表(`dto::LoaderKind::label()`)。 - `core/src/game/loader.rs` 与 `presenter/src/dto/instances.rs` 两处「显示路径 没有守卫(已知缺口)」改成 M134 之后的真形态:显示路径是委派(拿 core 的稳定 id 反查 DTO 词表,没有手写 match 可糊),新种类先在 `dto::LoaderKind::from_core` 编 不过,糊错的后果由 `loader_kind_ids_are_the_released_contract` 与按 `ALL` 遍历的 `every_core_loader_kind_reaches_the_tile_as_itself` 钉住。 - `presenter/src/host/game.rs` 无需改动:M134 当时已把它的文档改成新形态,读下来是 真话(`dto_kind` 的 doc 与两个测试的 doc 都对得上现在的代码)。 验证:fmt --all --check 通过;`cargo test -p unlucky-presenter -p unlucky-i18n` = i18n 29 passed / presenter 220 passed(1 ignored);clippy 两 crate --all-targets `-D warnings` 零告警。删后全仓(含 workspace 外的 crates/app)已无 `launch::loader_label` 引用。
This commit is contained in:
1 parent
ffb608c854
commit
321617861a
5 files changed
+12
-25
No files matched your search
@@ -32,9 +32,11 @@
|
||||
//! 词表,`json_rows_*` 钉真二进制输出面(0.2.0 已发出去过,所以这步是确认而不是可选)。
|
||||
//!
|
||||
//! ⚠️ 分工要看准:**编译器只拦「漏 match」**,新种类在消费方用 `=> Vanilla` 糊过去编得过。
|
||||
//! ③ 那条集合断言拦的是**对外词表**,但**拦不住显示路径**:`presenter/src/host/game.rs::dto_kind`
|
||||
//! 里糊一支 `=> Vanilla` 并把契约与 help 补齐后,三个 crate 全绿而磁贴静默显示「原版」——那处
|
||||
//! 目前**没有守卫**(已知缺口,另行记账)。**改名**同理:往返测试绿,只有 ③ 会红(故意再抄)。
|
||||
//! ③ 那条集合断言拦的是**对外词表**;**显示路径另有守卫**(M134 起):`presenter/src/host/game.rs::dto_kind`
|
||||
//! 不再是自己一张手写 match,而是拿 core 的稳定 id 反查 DTO 词表——想在那一支糊 `=> Vanilla` 已经
|
||||
//! 没有 match 可写,加一家加载器会在 `dto::LoaderKind::from_core` 先编不过;糊错由 presenter 的
|
||||
//! `loader_kind_ids_are_the_released_contract`、以及按 `ALL` 遍历不手抄清单的
|
||||
//! `every_core_loader_kind_reaches_the_tile_as_itself` 钉住。**改名**同理:往返测试绿,只有 ③ 会红。
|
||||
//!
|
||||
//! # 解析规则(按整段前缀匹配,大小写不敏感,**最靠左的标记胜**)
|
||||
//!
|
||||
|
||||
@@ -62,7 +62,7 @@ pub enum CoreText {
|
||||
/// 每一条都得在 `crates/presenter` / `crates/core` 里找得到出处(注释里给位置),
|
||||
/// 不许凭想象加——凭空加的条目会让 [`classify`] 假装覆盖了实际没覆盖的东西。
|
||||
const LEGACY_STATUS: &[(&str, Key)] = &[
|
||||
// `presenter::dto::instances::LoaderKind::label()` / `host::launch::loader_label()`
|
||||
// `presenter::dto::instances::LoaderKind::label()`(全仓唯一那份显示词表)
|
||||
("原版", Key::LoaderVanilla),
|
||||
// `presenter::host::job.rs`:`LogOutcome::SilentFail` 的展示文字
|
||||
("静默失败(exit 0 但游戏没起来)", Key::LaunchOutcomeSilent),
|
||||
|
||||
@@ -282,12 +282,12 @@ mod tests {
|
||||
}
|
||||
|
||||
/// 对外契约:七个 id 在测试里**独立抄一遍**(0.2.0 已发布形状),并与 core 的 `ALL` 做
|
||||
/// **集合比较**——这是对外词表的守卫(与 CLI 的 help 守卫互补;显示路径
|
||||
/// `presenter::host::game::dto_kind` 目前没有守卫,见 `game::loader` 的模块文档)。
|
||||
/// **集合比较**——这是对外词表的守卫(与 CLI 的 help 守卫互补)。显示路径另有守卫:
|
||||
/// `presenter::host::game::every_core_loader_kind_reaches_the_tile_as_itself`(按 `ALL` 遍历)。
|
||||
///
|
||||
/// 为什么不是编译器管:编译期只拦得到「漏 match」,而新种类在三处消费方用最省事的
|
||||
/// 为什么不是编译器管:编译期只拦得到「漏 match」,而新种类在还有 match 的消费方用最省事的
|
||||
/// `=> Vanilla` 糊过去**编得过**,那时新加载器会静默显示成原版(`game::loader` 模块文档
|
||||
/// 第 ③ 步)。真正拦住它的是下面第 ② 段的集合断言。
|
||||
/// 第 ③ 步)。对外词表由下面第 ② 段的集合断言守,显示路径由上面那条测试守。
|
||||
///
|
||||
/// 抓得住:改词表(`neoforge` → `neo_forge`);**新增一家加载器而没主动更新这份契约**
|
||||
/// (core 的 `ALL` 多一支 ⇒ 集合不等);DTO 委派接错支(`OptiFine` 映到 `LiteLoader`);
|
||||
|
||||
@@ -23,9 +23,7 @@ use unlucky_core::launch::tree_kill;
|
||||
use unlucky_core::launch::{Launcher, LauncherConfig};
|
||||
use unlucky_core::platform::paths::ProcessEnv;
|
||||
|
||||
use crate::dto::{
|
||||
InstanceId, InstanceRuntime, LaunchFinished, LaunchStage, LoaderKind, LogOutcome, Progress,
|
||||
};
|
||||
use crate::dto::{InstanceId, InstanceRuntime, LaunchFinished, LaunchStage, LogOutcome, Progress};
|
||||
|
||||
use super::env::HostEnv;
|
||||
use super::job::{launch_summary, HostTask, JobSender};
|
||||
@@ -334,19 +332,6 @@ fn describe_warning(warning: &AdapterWarning) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
/// 加载器 → 适配层的模组加载器标记(GUI 只用于显示,不改命令行)。
|
||||
pub fn loader_label(kind: LoaderKind) -> &'static str {
|
||||
match kind {
|
||||
LoaderKind::Vanilla => "原版",
|
||||
LoaderKind::Fabric => "Fabric",
|
||||
LoaderKind::Quilt => "Quilt",
|
||||
LoaderKind::Forge => "Forge",
|
||||
LoaderKind::NeoForge => "NeoForge",
|
||||
LoaderKind::OptiFine => "OptiFine",
|
||||
LoaderKind::LiteLoader => "LiteLoader",
|
||||
}
|
||||
}
|
||||
|
||||
/// 隔离档位的展示串(`isolated` / `shared`)。
|
||||
pub fn isolation_label(mode: IsolationMode) -> &'static str {
|
||||
mode.as_str()
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
//! 的完成报告:本 crate 的依赖树里只有 serde / serde_json / unlucky-core(及其自身依赖)。
|
||||
|
||||
// 关于 dead_code:host 里有一批「已定义、由单测覆盖、等 iced 页面接线才调用」的辅助函数
|
||||
// (`host::logs::session_finished`、`host::settings::clear_vendor_priority`、`loader_label`
|
||||
// (`host::logs::session_finished`、`host::settings::clear_vendor_priority`
|
||||
// 等)。它们原本住在 `crates/app` 里,由那边的 crate 级 `#![allow(dead_code)]` 一并放开;
|
||||
// 搬进 lib 之后「pub 但模块私有」会被判成死码。逐条 `#[allow]` 会把噪音藏进实现细节,
|
||||
// 这里沿用同一条策略统一放开,接线完成后再删掉本行暴露真死码。
|
||||
|
||||
Reference in new issue
Block a user