diff options
| author | Marijn Schouten <mhkbst@gmail.com> | 2025-07-10 07:44:24 +0000 |
|---|---|---|
| committer | Marijn Schouten <mhkbst@gmail.com> | 2025-07-11 05:39:27 +0000 |
| commit | a4e994ea43671bfe2065aed3a19a20fa04427750 (patch) | |
| tree | f80cb16d687b2a94c382e9040764ecadd8a94dd4 /src | |
| parent | ef5c209df3b8557e29af0482f2eeb004ff265621 (diff) | |
| download | rust-a4e994ea43671bfe2065aed3a19a20fa04427750.tar.gz rust-a4e994ea43671bfe2065aed3a19a20fa04427750.zip | |
tidy: simplify fluent file extension checking
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/tidy/src/fluent_alphabetical.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/tools/tidy/src/fluent_alphabetical.rs b/src/tools/tidy/src/fluent_alphabetical.rs index 8853681d4fb..48d14a37514 100644 --- a/src/tools/tidy/src/fluent_alphabetical.rs +++ b/src/tools/tidy/src/fluent_alphabetical.rs @@ -13,8 +13,8 @@ fn message() -> &'static Regex { static_regex!(r#"(?m)^([a-zA-Z0-9_]+)\s*=\s*"#) } -fn filter_fluent(path: &Path) -> bool { - if let Some(ext) = path.extension() { ext.to_str() != Some("ftl") } else { true } +fn is_fluent(path: &Path) -> bool { + path.extension().is_some_and(|ext| ext == "flt") } fn check_alphabetic( @@ -92,7 +92,7 @@ pub fn check(path: &Path, bless: bool, bad: &mut bool) { let mut all_defined_msgs = HashMap::new(); walk( path, - |path, is_dir| filter_dirs(path) || (!is_dir && filter_fluent(path)), + |path, is_dir| filter_dirs(path) || (!is_dir && !is_fluent(path)), &mut |ent, contents| { if bless { let sorted = sort_messages( |
