text, ui: borrow the app at the test call sites, and drop a redundant lifetime

Two things are one level deeper than the first pass at this review:

- Nine of the call sites that pass the resolved language are inside test functions, where `app`
  is owned, so `crate::i18n::language(app)` needs `&app`. `cargo check --all-targets` (which
  compiles the test modules as well) is what reported them; a check without it does not, which is
  how they survived the first round.
- `clippy -D warnings` rejects the explicit `'static` on `const KANA` / `const HAN`: a const
  already has one.

On this branch `cargo fmt --all --check`, `cargo check -p effectcraft-ui-egui --all-targets`,
`cargo clippy -p effectcraft-ui-egui --all-targets -- -D warnings` and
`cargo test -p effectcraft-ui-egui` (40 targets, 113 lib tests) are clean.
This commit is contained in:
FeiLiuEM
2026-10-09 20:34:03 +08:00
parent ad3da3c8de
commit 5344f304c3
8 changed files with 11 additions and 11 deletions
+2 -2
View File
@@ -316,8 +316,8 @@ fn install_cjk_fallbacks(family_fonts: &mut FontDefinitions, language: &str) ->
use effectcraft_text::fonts;
// Kana is unambiguously Japanese; Han ideographs are shared, so the order decides which
// language's face draws them.
const KANA: (char, &'static str) = ('あ', "japanese-system");
const HAN: (char, &'static str) = ('文', "chinese-system");
const KANA: (char, &str) = ('あ', "japanese-system");
const HAN: (char, &str) = ('文', "chinese-system");
// Han text follows the interface language, not the operating system's locale.
fonts::set_cjk_locale(cjk_locale(language));
let base = fonts::resolve("Inter", "Regular").face;