From d543da4e950909b5091969cb5c4e127a25f4caa4 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Mon, 8 Jul 2024 11:50:19 +0700 Subject: [PATCH] Fix `clippy::semicolon_if_nothing_returned` lints --- benches/glif_parse.rs | 14 +++++++------- src/datastore.rs | 2 +- src/font.rs | 2 +- src/glyph/builder.rs | 4 ++-- src/glyph/codepoints.rs | 2 +- src/glyph/parse.rs | 8 ++++---- src/glyph/serialize.rs | 6 +++--- src/layer.rs | 2 +- src/serde_xml_plist.rs | 2 +- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/benches/glif_parse.rs b/benches/glif_parse.rs index 7306fb6f..5bc8f678 100644 --- a/benches/glif_parse.rs +++ b/benches/glif_parse.rs @@ -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| { @@ -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: // @@ -80,7 +80,7 @@ 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| { @@ -88,7 +88,7 @@ pub fn criterion_benchmark(c: &mut Criterion) { let data = std::fs::read(black_box(CID61855)).unwrap(); // just make sure we can't be optimized away? assert!(data.len() != 42); - }) + }); }); } diff --git a/src/datastore.rs b/src/datastore.rs index a3557d20..75fcc7a5 100644 --- a/src/datastore.rs +++ b/src/datastore.rs @@ -258,7 +258,7 @@ impl Store { /// 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. diff --git a/src/font.rs b/src/font.rs index ee58ccf9..b7a3f211 100644 --- a/src/font.rs +++ b/src/font.rs @@ -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(); } } diff --git a/src/glyph/builder.rs b/src/glyph/builder.rs index 2628185e..500daaee 100644 --- a/src/glyph/builder.rs +++ b/src/glyph/builder.rs @@ -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 => { @@ -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 => { diff --git a/src/glyph/codepoints.rs b/src/glyph/codepoints.rs index 1571d9d9..c994d392 100644 --- a/src/glyph/codepoints.rs +++ b/src/glyph/codepoints.rs @@ -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. diff --git a/src/glyph/parse.rs b/src/glyph/parse.rs index 52cacb75..c328932b 100644 --- a/src/glyph/parse.rs +++ b/src/glyph/parse.rs @@ -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()); @@ -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 => { @@ -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()), } diff --git a/src/glyph/serialize.rs b/src/glyph/serialize.rs index d57e8a5f..3d84d0dc 100644 --- a/src/glyph/serialize.rs +++ b/src/glyph/serialize.rs @@ -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 { diff --git a/src/layer.rs b/src/layer.rs index 12614bbd..6fa9b7b5 100644 --- a/src/layer.rs +++ b/src/layer.rs @@ -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. diff --git a/src/serde_xml_plist.rs b/src/serde_xml_plist.rs index b47c626a..a4a9771d 100644 --- a/src/serde_xml_plist.rs +++ b/src/serde_xml_plist.rs @@ -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) }