From 271a2a7296be4b9ba4a0f7b6e13a09fb5377d83f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Legrand?= Date: Sun, 1 Nov 2026 22:08:57 +0100 Subject: [PATCH] style: remove review churn --- crates/i18n/src/collate.rs | 2 -- crates/i18n/src/fold.rs | 8 -------- crates/i18n/src/format.rs | 4 ---- crates/i18n/src/lib.rs | 6 ------ crates/i18n/src/region.rs | 3 --- crates/i18n/src/scripts.rs | 6 ------ crates/i18n/src/size.rs | 3 --- 7 files changed, 32 deletions(-) diff --git a/crates/i18n/src/collate.rs b/crates/i18n/src/collate.rs index 629b3bf75..06d417897 100644 --- a/crates/i18n/src/collate.rs +++ b/crates/i18n/src/collate.rs @@ -30,7 +30,6 @@ impl Collator { /// Sorting for `locale`, a language code such as `sv`, `pt-br` or `zh-hant` (any case, `-` /// or `_`, glibc forms such as `sv_SE.UTF-8` and `sr_RS@latin`). A BCP 47 collation type /// picks another order where there is one: `zh-hant-u-co-pinyin`, `zh-hans-u-co-stroke`. - #[must_use] pub fn new(locale: &str) -> Collator { let mut prefs: CollatorPreferences = Locale::try_from_str(&bcp47(locale)).unwrap_or(Locale::UNKNOWN).into(); prefs.numeric_ordering = Some(CollationNumericOrdering::True); @@ -47,7 +46,6 @@ impl Collator { /// the collation counts as equal (`Layer 2` and `Layer 02`) is in code point order, so a sort /// doesn't depend on the input order. Without collation data (never with the embedded data) /// this is code point order. - #[must_use] pub fn compare(&self, a: &str, b: &str) -> Ordering { match &self.0 { Some(c) => c.as_borrowed().compare(a, b).then_with(|| a.cmp(b)), diff --git a/crates/i18n/src/fold.rs b/crates/i18n/src/fold.rs index dd77b6dfd..fb420e1e1 100644 --- a/crates/i18n/src/fold.rs +++ b/crates/i18n/src/fold.rs @@ -34,7 +34,6 @@ pub struct Folder { impl Folder { /// Case- and accent-insensitive folding for `locale`, a language code such as `tr`, `pt-br` /// or `zh-hant` (any case, `-` or `_`). - #[must_use] pub fn new(locale: &str) -> Folder { let language = locale.split(['-', '_', '.', '@']).next().unwrap_or_default(); Folder { turkic: language.eq_ignore_ascii_case("tr") || language.eq_ignore_ascii_case("az"), accents: false } @@ -42,13 +41,11 @@ impl Folder { /// Accents count: `é` no longer matches `e`, and a match can't end on a letter whose accent it /// leaves out. - #[must_use] pub fn keep_accents(self) -> Folder { Folder { accents: true, ..self } } /// `s` folded, with the map back to `s`. - #[must_use] pub fn fold(&self, s: &str) -> Folded { let nfkd = DecomposingNormalizerBorrowed::new_nfkd(); let extend = CodePointSetData::new::(); @@ -78,13 +75,11 @@ impl Folder { } /// `s` folded, without the map: a key to compare or store. - #[must_use] pub fn key(&self, s: &str) -> String { self.fold(s).text } /// Whether `haystack` contains `needle`, both folded. - #[must_use] pub fn contains(&self, haystack: &str, needle: &str) -> bool { self.fold(haystack).find(&self.fold(needle)).is_some() } @@ -224,7 +219,6 @@ pub struct Folded { impl Folded { /// The folded text. - #[must_use] pub fn as_str(&self) -> &str { &self.text } @@ -232,7 +226,6 @@ impl Folded { /// The source byte range that folded bytes `range` came from, widened to whole source /// characters with their accents: `ss` in the folding of `Straße` maps back to `ß`, `e` in /// that of `é` to the whole `é`. An empty range maps to an empty one. - #[must_use] pub fn source_range(&self, range: Range) -> Range { // The last cluster starting at or before `at` is the one holding it: clusters that fold to // nothing share their offset with the next one. @@ -248,7 +241,6 @@ impl Folded { /// The first match of `needle` (folded the same way), as a byte range of the source text. /// An empty needle matches at the start. - #[must_use] pub fn find(&self, needle: &Folded) -> Option> { self.matches(needle).next() } diff --git a/crates/i18n/src/format.rs b/crates/i18n/src/format.rs index badfbdfca..b907b469c 100644 --- a/crates/i18n/src/format.rs +++ b/crates/i18n/src/format.rs @@ -82,7 +82,6 @@ impl Format { } /// The format for a locale tag (`de-CH`, `ar-EG`), with the locale's own digits. - #[must_use] pub fn from_tag(tag: &str) -> Format { Format::new(&Region::from_tag(tag), Digits::Locale) } @@ -94,7 +93,6 @@ impl Format { /// `value` rounded to `decimals` digits after the decimal separator; infinities and NaN are /// `∞`, `-∞` and `NaN`. - #[must_use] pub fn number(&self, value: f64, decimals: usize) -> String { match to_decimal(value, decimals) { Some(d) => self.write(&d), @@ -104,7 +102,6 @@ impl Format { /// [`Self::number`] without grouping separators, for values such as pixel sizes and years: /// `1920`, `١٩٢٠`, `1234,5`. - #[must_use] pub fn number_ungrouped(&self, value: f64, decimals: usize) -> String { match to_decimal(value, decimals) { Some(d) => { @@ -117,7 +114,6 @@ impl Format { /// `ratio` as a percentage with `decimals` digits after the decimal separator: `0.5` is /// `50%`, `50 %` (French, German), `%50` (Turkish), `٥٠٪؜` (Egyptian Arabic). - #[must_use] pub fn percent(&self, ratio: f64, decimals: usize) -> String { let Some(d) = to_decimal(ratio * 100.0, decimals) else { return format!("{}{}{}", self.percent.0, non_finite(ratio), self.percent.1); diff --git a/crates/i18n/src/lib.rs b/crates/i18n/src/lib.rs index ce473d84f..24ce578a6 100644 --- a/crates/i18n/src/lib.rs +++ b/crates/i18n/src/lib.rs @@ -158,7 +158,6 @@ impl I18n { /// to left, say). Locales that can't be used are skipped and come back as problems for the app /// to log. A locale's bad rows are logged (`log::warn!`) when it is first looked up in, and /// [`I18n::check_all`] lists them all. - #[must_use] pub fn new(embedded: &'static Embedded, offered: &[&str]) -> (I18n, Vec) { let mut problems = Vec::new(); let mut locales = vec![bare("en"), bare("pseudo")]; @@ -420,7 +419,6 @@ impl I18n { /// value that already is one isolate keeps it; pass numbers, paths and codes through [`ltr`]. /// Other text gets no marks, and a value's own isolate is taken off. Unknown placeholders stay as written, /// and inserted values are never read as templates, so a file name containing `{n}` stays intact. -#[must_use] pub fn fmt(template: &str, args: &[(&str, &str)]) -> String { fill(template, args, true) } @@ -428,7 +426,6 @@ pub fn fmt(template: &str, args: &[(&str, &str)]) -> String { /// [`fmt`] without isolates, for text that goes where the marks would get in the way: file /// names, logs, terminals, text compared or parsed later. Every isolate mark is taken off, in /// the template and in the values. -#[must_use] pub fn fmt_plain(template: &str, args: &[(&str, &str)]) -> String { strip_isolates(&fill(template, args, false)) } @@ -449,7 +446,6 @@ const ALM: char = '\u{061C}'; /// `value` as a first-strong isolate (FSI…PDI): it takes the direction of its first strong /// letter and can't reorder the text around it. What [`fmt`] does to each value in text with a /// right-to-left letter. -#[must_use] pub fn isolate(value: &str) -> String { wrap(FSI, value) } @@ -458,14 +454,12 @@ pub fn isolate(value: &str) -> String { /// codes, which read left to right in every language. In an RTL first-strong isolate, the /// segments of `/home/مستخدم/file.txt` would run right to left. [`fmt`] takes the isolate off /// again in text with no right-to-left letter. -#[must_use] pub fn ltr(value: &str) -> String { wrap(LRI, value) } /// `text` without isolate marks (LRI, RLI, FSI, PDI): a [`fmt`] or [`I18n::trn`] result made fit /// for a file name, a log or a comparison. -#[must_use] pub fn strip_isolates(text: &str) -> String { text.chars().filter(|c| !matches!(*c, LRI | RLI | FSI | PDI)).collect() } diff --git a/crates/i18n/src/region.rs b/crates/i18n/src/region.rs index 205444c25..15874d67f 100644 --- a/crates/i18n/src/region.rs +++ b/crates/i18n/src/region.rs @@ -73,7 +73,6 @@ impl Region { /// `nu` stays in the number and time locales (`ar-EG-u-nu-latn`). `C` and `POSIX` are the C /// locale: English, A4, metric, a `.` decimal and no grouping. An empty or unreadable tag is /// `en-US`; a bare `en` is the United States, any other bare language has no territory. - #[must_use] pub fn from_tag(tag: &str) -> Region { match Tag::parse(tag) { Some(tag) => Region::from_parts(&tag), @@ -86,7 +85,6 @@ impl Region { /// The region for an app's saved region setting: `""` or `auto` (any case) is /// [`Region::system`], anything else a locale tag for [`Region::from_tag`]. - #[must_use] pub fn from_setting(setting: &str) -> Region { let setting = setting.trim(); if setting.is_empty() || setting.eq_ignore_ascii_case("auto") { Region::system() } else { Region::from_tag(setting) } @@ -101,7 +99,6 @@ impl Region { /// - Linux and the BSDs: `LC_ALL`, else each of `LC_NUMERIC`, `LC_TIME`, `LC_MEASUREMENT` and /// `LC_PAPER` on its own, else `LANG`. /// - The web and Android: the preferred language, the only locale they expose. - #[must_use] pub fn system() -> Region { static SYSTEM: OnceLock = OnceLock::new(); SYSTEM.get_or_init(read_system).clone() diff --git a/crates/i18n/src/scripts.rs b/crates/i18n/src/scripts.rs index e16342e26..aa39d8917 100644 --- a/crates/i18n/src/scripts.rs +++ b/crates/i18n/src/scripts.rs @@ -39,7 +39,6 @@ pub enum Script { impl Script { /// The ISO 15924 code, `Latn`. - #[must_use] pub fn code(self) -> &'static str { match self { Script::Arab => "Arab", @@ -76,7 +75,6 @@ impl Script { } /// Whether text in this script runs right to left. - #[must_use] pub fn rtl(self) -> bool { matches!(self, Script::Arab | Script::Hebr | Script::Syrc | Script::Thaa) } @@ -114,7 +112,6 @@ pub enum Han { /// where it is the language's own script. A language not in the table is taken to be written in /// Latin. // ponytail: the languages a Craft app ships or could plausibly ship; add a row with the locale. -#[must_use] pub fn scripts(tag: &str) -> &'static [Script] { use Script::{ Arab, Armn, Beng, Cyrl, Deva, Ethi, Geor, Grek, Gujr, Guru, Hang, Hani, Hebr, Hira, Kana, Khmr, Knda, Laoo, Latn, Mlym, Mymr, Orya, Sinh, @@ -160,7 +157,6 @@ pub fn scripts(tag: &str) -> &'static [Script] { } /// The direction of a language tag's text: right to left when its main script is. -#[must_use] pub fn direction(tag: &str) -> Direction { match scripts(tag).first() { Some(s) if s.rtl() => Direction::Rtl, @@ -172,7 +168,6 @@ pub fn direction(tag: &str) -> Direction { /// P3): the contents of isolates (LRI, RLI or FSI up to the matching PDI) are skipped, and the /// search stops at the first paragraph separator. `None` when the paragraph has no strong /// character; P3 then reads it as left to right, and an app may use the interface direction. -#[must_use] pub fn base_direction(text: &str) -> Option { match unicode_bidi::get_base_direction(text) { unicode_bidi::Direction::Ltr => Some(Direction::Ltr), @@ -186,7 +181,6 @@ pub fn base_direction(text: &str) -> Option { /// (`zh-US`, `zh-AU`) → Traditional; `zh-HK`, `zh-MO`, `zh-Hant-HK` and `yue` → `HongKong`; `ja` → /// Japanese; `ko` → Korean. `None` for a language not written with Han, which leaves the choice /// to the font stack. -#[must_use] pub fn han(tag: &str) -> Option { let tag = Subtags::parse(tag); let hong_kong = matches!(tag.region.as_deref(), Some("hk" | "mo")); diff --git a/crates/i18n/src/size.rs b/crates/i18n/src/size.rs index b316360a5..e0d45d59d 100644 --- a/crates/i18n/src/size.rs +++ b/crates/i18n/src/size.rs @@ -33,7 +33,6 @@ impl SizeUnit { /// // `12 MB`, `3.4 MB`, `640 KB`: decimal steps, whole kilobytes, no decimals from 10 MB. /// let style = FileSize::DECIMAL.smallest(SizeUnit::Kilo).largest(SizeUnit::Mega).unit_decimals(SizeUnit::Kilo, 0).whole_from(10); /// ``` -#[must_use] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub struct FileSize { step: u64, @@ -166,7 +165,6 @@ impl FileSize { impl I18n { /// `bytes` as a file size in `lang`, written the way `style` says (`1.5 MB`, `512 bytes`), the /// number as [`I18n::format`] writes it (`1,5 Mo`). - #[must_use] pub fn file_size(&self, lang: Lang, bytes: u64, style: FileSize) -> String { let (unit, n, decimals) = style.parts(bytes); if unit == SizeUnit::Byte && !style.byte_symbol { @@ -178,7 +176,6 @@ impl I18n { /// `value` with `decimals` digits after the decimal separator in the unit template `unit`, an /// English catalog key with the number as `{n}` (`{n} px`, `{n} dB`), the number as /// [`I18n::format`] writes it. Percentages are [`crate::Format::percent`]. - #[must_use] pub fn measure(&self, lang: Lang, value: f64, decimals: usize, unit: &str) -> String { self.unit_text(lang, unit, &self.format().number(value, decimals)) }