chore(m197): 清掉 clippy 的三处拒绝 + 一处 2018 idioms 警告
CI 的门禁是 `cargo clippy --workspace --all-targets -- -D warnings`: 冗余闭包 / 用例表的类型复杂度 / Default 之后逐字段赋值 / elided lifetime 四处都会红。 纯实现侧改动,行为不变(757 + 31 全绿)。
This commit is contained in:
1 parent
ce463cc9b5
commit
9a7b138d08
3 files changed
+11
-6
No files matched your search
@@ -235,7 +235,10 @@ fn every_download_template_renders_without_leftover_placeholders() {
|
||||
use unlucky_i18n::{Key, Lang};
|
||||
|
||||
let catalog = Lang::En.catalog();
|
||||
let cases: [(&str, Key, &[(&str, &str)]); 6] = [
|
||||
/// 一条用例:标签 / key / 渲染参数。
|
||||
type Case<'a> = (&'a str, Key, &'a [(&'a str, &'a str)]);
|
||||
|
||||
let cases: [Case<'_>; 6] = [
|
||||
(
|
||||
"failed",
|
||||
Key::SettingsJavaDownloadFailed,
|
||||
|
||||
@@ -100,7 +100,7 @@ pub fn effective(config: &Path, prefs: &Prefs) -> Effective {
|
||||
let text = prefs.saved_install_root.trim();
|
||||
(!text.is_empty()).then(|| PathBuf::from(text))
|
||||
};
|
||||
let layout = home_of(config).map(|home| LauncherLayout::new(home));
|
||||
let layout = home_of(config).map(LauncherLayout::new);
|
||||
let (root, root_mode, root_layer, root_unresolved) = match &layout {
|
||||
Some(layout) => match JavaInstallRoot::resolve(
|
||||
data_mode,
|
||||
|
||||
@@ -40,11 +40,13 @@ fn the_three_keys_are_written_and_read_back() {
|
||||
let dir = root("prefs-save");
|
||||
let file = config(&dir);
|
||||
|
||||
let mut prefs = Prefs::default();
|
||||
// 前后带空格:落盘值会被 trim,回读的草稿必须显示**磁盘上那份**。
|
||||
prefs.install_root = " D:/JDKs ".to_string();
|
||||
prefs.auto_install = false;
|
||||
prefs.priority = vec!["zulu", "temurin"];
|
||||
let mut prefs = Prefs {
|
||||
install_root: " D:/JDKs ".to_string(),
|
||||
auto_install: false,
|
||||
priority: vec!["zulu", "temurin"],
|
||||
..Prefs::default()
|
||||
};
|
||||
assert!(prefs.dirty(), "改过三键就该是脏的");
|
||||
|
||||
let snapshot = prefs_store::save(&file, &prefs).expect("三键应能落盘");
|
||||
|
||||
Reference in new issue
Block a user