Skip to content

Commit

Permalink
Merge pull request #349 from waywardmonkeys/add-semicolons
Browse files Browse the repository at this point in the history
Fix `clippy::semicolon_if_nothing_returned` lints
  • Loading branch information
RickyDaMa authored Jul 8, 2024
2 parents cf54bab + d543da4 commit 187295f
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 21 deletions.
14 changes: 7 additions & 7 deletions benches/glif_parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,28 +38,28 @@ pub fn criterion_benchmark(c: &mut Criterion) {
let bytes = load_bytes(S_GLYPH);
b.iter(|| {
Glyph::parse_raw(black_box(&bytes)).unwrap();
})
});
});
// a very small glyph
c.bench_function("parse dot", |b| {
let bytes = load_bytes(DOT);
b.iter(|| {
Glyph::parse_raw(black_box(&bytes)).unwrap();
})
});
});
// a very large glyph
c.bench_function("parse large CJK glyph", |b| {
let bytes = load_bytes(CID61855);
b.iter(|| {
Glyph::parse_raw(black_box(&bytes)).unwrap();
})
});
});
// a component glyph
c.bench_function("parse A_acute", |b| {
let bytes = load_bytes(A_ACUTE_GLYPH);
b.iter(|| {
Glyph::parse_raw(black_box(&bytes)).unwrap();
})
});
});
// many glyphs
c.bench_function("parse MutatorSansLightWide glyphs", |b| {
Expand All @@ -69,7 +69,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
for glyph_bytes in &glyphs {
Glyph::parse_raw(black_box(glyph_bytes)).unwrap();
}
})
});
});
// Note to somebody using this:
//
Expand All @@ -80,15 +80,15 @@ pub fn criterion_benchmark(c: &mut Criterion) {
let data = std::fs::read(black_box(S_GLYPH)).unwrap();
// just make sure we can't be optimized away?
assert!(data.len() != 42);
})
});
});

c.bench_function("load large CJK glyph", |b| {
b.iter(|| {
let data = std::fs::read(black_box(CID61855)).unwrap();
// just make sure we can't be optimized away?
assert!(data.len() != 42);
})
});
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/datastore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ impl<T: DataType> Store<T> {

/// Clears the store, removing all path-data pairs. Keeps the allocated memory for reuse.
pub fn clear(&mut self) {
self.items.clear()
self.items.clear();
}

/// Returns the number of elements in the store.
Expand Down
2 changes: 1 addition & 1 deletion src/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,6 @@ mod tests {
let opt = WriteOptions::default();
let ufo = Font::default();
let tmp = TempDir::new().unwrap();
ufo.save_with_options(tmp, &opt).unwrap()
ufo.save_with_options(tmp, &opt).unwrap();
}
}
4 changes: 2 additions & 2 deletions src/glyph/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl OutlineBuilder {
if smooth {
return Err(ErrorKind::UnexpectedSmooth);
}
*number_of_offcurves = number_of_offcurves.saturating_add(1)
*number_of_offcurves = number_of_offcurves.saturating_add(1);
}
PointType::QCurve => *number_of_offcurves = 0,
PointType::Curve => {
Expand Down Expand Up @@ -140,7 +140,7 @@ impl OutlineBuilder {
for point in &scratch_contour.points {
match point.typ {
PointType::OffCurve => {
number_of_offcurves = number_of_offcurves.saturating_add(1)
number_of_offcurves = number_of_offcurves.saturating_add(1);
}
PointType::QCurve => break,
PointType::Curve => {
Expand Down
2 changes: 1 addition & 1 deletion src/glyph/codepoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl Codepoints {

/// Remove all codepoints from the set.
pub fn clear(&mut self) {
self.0.clear()
self.0.clear();
}

/// Returns true if the provided codepoint is in this set.
Expand Down
8 changes: 4 additions & 4 deletions src/glyph/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ impl<'names> GlifParser<'names> {
}
b"outline" => {
seen_outline = true;
self.parse_outline(reader, buf)?
self.parse_outline(reader, buf)?;
}
b"lib" if seen_lib => {
return Err(ErrorKind::DuplicateElement("lib").into());
}
b"lib" => {
seen_lib = true;
self.parse_lib(reader, raw_xml, buf)?
self.parse_lib(reader, raw_xml, buf)?;
}
b"note" if self.version == VERSION_1 => {
return Err(ErrorKind::UnexpectedV1Element("note").into());
Expand All @@ -96,7 +96,7 @@ impl<'names> GlifParser<'names> {
}
b"advance" => {
seen_advance = true;
self.parse_advance(start)?
self.parse_advance(start)?;
}
b"unicode" => self.parse_unicode(start)?,
b"anchor" if self.version == VERSION_1 => {
Expand Down Expand Up @@ -143,7 +143,7 @@ impl<'names> GlifParser<'names> {
let mut new_buf = Vec::new(); // borrowck :/
match start.name().as_ref() {
b"contour" => {
self.parse_contour(start, reader, &mut new_buf, &mut outline_builder)?
self.parse_contour(start, reader, &mut new_buf, &mut outline_builder)?;
}
_other => return Err(ErrorKind::UnexpectedElement.into()),
}
Expand Down
6 changes: 3 additions & 3 deletions src/glyph/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,15 @@ impl Guideline {
}

if let Some(x) = x {
start.push_attribute(("x", x.to_string().as_str()))
start.push_attribute(("x", x.to_string().as_str()));
}

if let Some(y) = y {
start.push_attribute(("y", y.to_string().as_str()))
start.push_attribute(("y", y.to_string().as_str()));
}

if let Some(angle) = angle {
start.push_attribute(("angle", angle.to_string().as_str()))
start.push_attribute(("angle", angle.to_string().as_str()));
}

if let Some(color) = &self.color {
Expand Down
2 changes: 1 addition & 1 deletion src/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ impl Layer {
pub fn clear(&mut self) {
self.contents.clear();
self.path_set.clear();
self.glyphs.clear()
self.glyphs.clear();
}

/// Remove the named glyph from this layer and return it, if it exists.
Expand Down
2 changes: 1 addition & 1 deletion src/serde_xml_plist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ mod de {
{
let mut array = Vec::with_capacity(map.size_hint().unwrap_or_default());
while let Some(value) = read_xml_value(&mut map)? {
array.push(value)
array.push(value);
}
Ok(array)
}
Expand Down

0 comments on commit 187295f

Please sign in to comment.