Skip to content

Commit

Permalink
Fix lints
Browse files Browse the repository at this point in the history
  • Loading branch information
madig committed Jul 15, 2022
1 parent 2513e62 commit 67a3f66
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
26 changes: 13 additions & 13 deletions src/fontinfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ impl FontInfo {
.unitsPerEm
.map(|v| NonNegativeIntegerOrFloat::new(v.abs()).unwrap()),
version_major: fontinfo_v2.versionMajor,
version_minor: fontinfo_v2.versionMinor.map(|v| v.abs() as NonNegativeInteger),
version_minor: fontinfo_v2.versionMinor.map(|v| v.unsigned_abs()),
x_height: fontinfo_v2.xHeight,
year: fontinfo_v2.year,
..FontInfo::default()
Expand Down Expand Up @@ -696,7 +696,7 @@ impl FontInfo {
open_type_os2_weight_class: match fontinfo_v1.weightValue {
Some(v) => match v {
-1 => None,
_ => Some(v.abs() as NonNegativeInteger),
_ => Some(v.unsigned_abs()),
},
None => None,
},
Expand Down Expand Up @@ -780,7 +780,7 @@ impl FontInfo {
.unitsPerEm
.map(|v| NonNegativeIntegerOrFloat::new(v.abs()).unwrap()),
version_major: fontinfo_v1.versionMajor,
version_minor: fontinfo_v1.versionMinor.map(|v| v.abs() as NonNegativeInteger),
version_minor: fontinfo_v1.versionMinor.map(|v| v.unsigned_abs()),
x_height: fontinfo_v1.xHeight,
year: fontinfo_v1.year,
..FontInfo::default()
Expand Down Expand Up @@ -1353,16 +1353,16 @@ impl<'de> Deserialize<'de> for Os2Panose {
impl From<Os2PanoseV2> for Os2Panose {
fn from(value: Os2PanoseV2) -> Self {
Os2Panose {
family_type: value.family_type.abs() as NonNegativeInteger,
serif_style: value.serif_style.abs() as NonNegativeInteger,
weight: value.weight.abs() as NonNegativeInteger,
proportion: value.proportion.abs() as NonNegativeInteger,
contrast: value.contrast.abs() as NonNegativeInteger,
stroke_variation: value.stroke_variation.abs() as NonNegativeInteger,
arm_style: value.arm_style.abs() as NonNegativeInteger,
letterform: value.letterform.abs() as NonNegativeInteger,
midline: value.midline.abs() as NonNegativeInteger,
x_height: value.x_height.abs() as NonNegativeInteger,
family_type: value.family_type.unsigned_abs(),
serif_style: value.serif_style.unsigned_abs(),
weight: value.weight.unsigned_abs(),
proportion: value.proportion.unsigned_abs(),
contrast: value.contrast.unsigned_abs(),
stroke_variation: value.stroke_variation.unsigned_abs(),
arm_style: value.arm_style.unsigned_abs(),
letterform: value.letterform.unsigned_abs(),
midline: value.midline.unsigned_abs(),
x_height: value.x_height.unsigned_abs(),
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/util.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Common utilities.

use std::fmt::Write as _;
use std::{collections::HashSet, path::PathBuf};

use crate::Name;
Expand Down Expand Up @@ -152,7 +153,7 @@ fn user_name_to_file_name(

let mut found_unique = false;
for counter in 1..100u8 {
result.push_str(&format!("{:0>2}", counter));
write!(&mut result, "{:0>2}", counter).unwrap();
result.push_str(suffix);
if !existing.contains(&result.to_lowercase()) {
found_unique = true;
Expand Down

0 comments on commit 67a3f66

Please sign in to comment.