Skip to content

Commit

Permalink
Fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
laurmaedje committed Oct 4, 2023
1 parent fcef54e commit 2e7f604
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/cff/dict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ impl<'a> Structure<'a> for Operand<'a> {
}
Self::Real(real) => {
w.write::<u8>(30);
w.give(&real);
w.give(real);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/cff/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ pub(crate) fn subset(ctx: &mut Context) -> Result<()> {
}

/// Subset the glyph descriptions.
fn subset_char_strings<'a>(ctx: &Context, strings: &mut Index<Opaque<'a>>) -> Result<()> {
fn subset_char_strings(ctx: &Context, strings: &mut Index<Opaque>) -> Result<()> {
for glyph in 0..ctx.num_glyphs {
if !ctx.subset.contains(&glyph) {
// The byte sequence [14] is the minimal valid charstring consisting
Expand Down Expand Up @@ -318,7 +318,7 @@ fn write_cid_data(w: &mut Writer, cid: &CidData, offsets: &mut CidOffsets) {
}

/// Read a Private DICT and optionally local subroutines.
fn read_private_dict<'a>(cff: &'a [u8], range: Range<usize>) -> Result<PrivateData<'a>> {
fn read_private_dict(cff: &[u8], range: Range<usize>) -> Result<PrivateData<'_>> {
let start = range.start;
let sub = cff.get(range).ok_or(Error::InvalidOffset)?;
let dict = Dict::read_at(sub, 0)?;
Expand Down Expand Up @@ -520,7 +520,7 @@ impl<'a> Structure<'a> for Opaque<'a> {
}

fn write(&self, w: &mut Writer) {
w.give(&self.0);
w.give(self.0);
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl<'a> Profile<'a> {
pub fn subset(data: &[u8], index: u32, profile: Profile) -> Result<Vec<u8>> {
let face = parse(data, index)?;
let kind = match face.table(Tag::CFF).or(face.table(Tag::CFF2)) {
Some(_) => FontKind::CFF,
Some(_) => FontKind::Cff,
None => FontKind::TrueType,
};

Expand All @@ -119,7 +119,7 @@ pub fn subset(data: &[u8], index: u32, profile: Profile) -> Result<Vec<u8>> {
ctx.process(Tag::GASP)?;
}

if ctx.kind == FontKind::CFF {
if ctx.kind == FontKind::Cff {
cff::discover(&mut ctx);
ctx.process(Tag::CFF)?;
ctx.process(Tag::CFF2)?;
Expand Down Expand Up @@ -329,7 +329,7 @@ enum FontKind {
/// TrueType outlines.
TrueType,
/// CFF outlines
CFF,
Cff,
/// A font collection.
Collection,
}
Expand All @@ -338,7 +338,7 @@ impl Structure<'_> for FontKind {
fn read(r: &mut Reader) -> Result<Self> {
match r.read::<u32>()? {
0x00010000 | 0x74727565 => Ok(FontKind::TrueType),
0x4F54544F => Ok(FontKind::CFF),
0x4F54544F => Ok(FontKind::Cff),
0x74746366 => Ok(FontKind::Collection),
_ => Err(Error::UnknownKind),
}
Expand All @@ -347,7 +347,7 @@ impl Structure<'_> for FontKind {
fn write(&self, w: &mut Writer) {
w.write::<u32>(match self {
FontKind::TrueType => 0x00010000,
FontKind::CFF => 0x4F54544F,
FontKind::Cff => 0x4F54544F,
FontKind::Collection => 0x74746366,
})
}
Expand Down Expand Up @@ -523,7 +523,7 @@ mod tests {
}

fn test(path: &str, text: &str) {
test_impl(path, &text, true);
test_impl(path, text, true);
}

fn test_full(path: &str) {
Expand Down

0 comments on commit 2e7f604

Please sign in to comment.