From cebe274cc144acf2390529dae6a19c1b563f215e Mon Sep 17 00:00:00 2001 From: Colin Rofls Date: Fri, 21 Feb 2025 10:50:45 -0500 Subject: [PATCH] [chore] Clippy day --- fontbe/src/features.rs | 10 ++-------- fontc/src/lib.rs | 6 +++--- ufo2fontir/src/source.rs | 4 ++-- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/fontbe/src/features.rs b/fontbe/src/features.rs index b43c3a0c..5424204b 100644 --- a/fontbe/src/features.rs +++ b/fontbe/src/features.rs @@ -199,10 +199,7 @@ pub(crate) fn resolve_variable_metric<'a>( .iter() .filter_map(|(region, value)| { let scaler = region.scalar_at(&var_model.default).into_inner(); - match scaler { - scaler if scaler == 0.0 => None, - scaler => Some(scaler * { *value }), - } + (scaler != 0.0).then_some(*value * scaler) }) .sum::() .ot_round(); @@ -337,10 +334,7 @@ impl VariationInfo for FeaVariationInfo<'_> { .iter() .filter_map(|(region, value)| { let scaler = region.scalar_at(&var_model.default).into_inner(); - match scaler { - scaler if scaler == 0.0 => None, - scaler => Some(scaler * { *value }), - } + (scaler != 0.0).then_some(*value * scaler) }) .sum::() .ot_round(); diff --git a/fontc/src/lib.rs b/fontc/src/lib.rs index ab9972f7..02c99b30 100644 --- a/fontc/src/lib.rs +++ b/fontc/src/lib.rs @@ -620,7 +620,7 @@ mod tests { fn compile_obeys_family_class() { let result = TestCompile::compile_source("fontinfo.designspace"); let os2 = result.font().os2().unwrap(); - assert_eq!(1 << 8 | 2, os2.s_family_class()); + assert_eq!((1 << 8) | 2, os2.s_family_class()); } #[test] @@ -2769,7 +2769,7 @@ mod tests { let os2 = font.os2().unwrap(); assert_eq!( - [1 | 1 << 28, 1 << 20 | 1 << 24, 0, 1 << 26], + [1 | (1 << 28), (1 << 20) | (1 << 24), 0, 1 << 26], [ os2.ul_unicode_range_1(), os2.ul_unicode_range_2(), @@ -2795,7 +2795,7 @@ mod tests { let os2 = font.os2().unwrap(); assert_eq!( - [Some(1 | 1 << 1 | 1 << 19), Some(1 << 31)], + [Some(1 | (1 << 1) | (1 << 19)), Some(1 << 31)], [os2.ul_code_page_range_1(), os2.ul_code_page_range_2(),] ); } diff --git a/ufo2fontir/src/source.rs b/ufo2fontir/src/source.rs index 4976e944..02c8e9cc 100644 --- a/ufo2fontir/src/source.rs +++ b/ufo2fontir/src/source.rs @@ -832,7 +832,7 @@ impl Work for StaticMetadataWork { font_info_at_default .open_type_os2_type .as_ref() - .map(|flags| flags.iter().fold(0_u16, |acc, e| acc | 1 << *e)) + .map(|flags| flags.iter().fold(0_u16, |acc, e| acc | (1 << *e))) .unwrap_or(1_u16 << 2), ); @@ -881,7 +881,7 @@ impl Work for StaticMetadataWork { static_metadata.misc.family_class = font_info_at_default .open_type_os2_family_class .as_ref() - .map(|v| (v.class_id as i16) << 8 | v.subclass_id as i16); + .map(|v| ((v.class_id as i16) << 8) | v.subclass_id as i16); static_metadata.misc.created = try_parse_date(font_info_at_default.open_type_head_created.as_ref())