Skip to content

Commit

Permalink
Merge pull request #1290 from googlefonts/clippy-etc
Browse files Browse the repository at this point in the history
[chore] Clippy day
  • Loading branch information
anthrotype authored Feb 21, 2025
2 parents 6b9d633 + cebe274 commit bcfa7aa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
10 changes: 2 additions & 8 deletions fontbe/src/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<f64>()
.ot_round();
Expand Down Expand Up @@ -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::<f64>()
.ot_round();
Expand Down
6 changes: 3 additions & 3 deletions fontc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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(),
Expand All @@ -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(),]
);
}
Expand Down
4 changes: 2 additions & 2 deletions ufo2fontir/src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ impl Work<Context, WorkId, Error> 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),
);

Expand Down Expand Up @@ -881,7 +881,7 @@ impl Work<Context, WorkId, Error> 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())
Expand Down

0 comments on commit bcfa7aa

Please sign in to comment.