From a03bc516933aa24e042a00167f9453d9a7ea1ed1 Mon Sep 17 00:00:00 2001 From: Colin Rofls Date: Mon, 8 Jan 2024 11:37:42 -0500 Subject: [PATCH] [clippy] Push the rock back up the hill --- read-fonts/src/tables/fvar.rs | 6 +++--- write-fonts/src/lib.rs | 1 + write-fonts/src/tables/gvar/iup.rs | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/read-fonts/src/tables/fvar.rs b/read-fonts/src/tables/fvar.rs index b14842b38..5fef988c1 100644 --- a/read-fonts/src/tables/fvar.rs +++ b/read-fonts/src/tables/fvar.rs @@ -47,7 +47,7 @@ mod tests { let font = FontRef::new(font_test_data::VAZIRMATN_VAR).unwrap(); let fvar = font.fvar().unwrap(); assert_eq!(fvar.axis_count(), 1); - let wght = &fvar.axes().unwrap().get(0).unwrap(); + let wght = &fvar.axes().unwrap().first().unwrap(); assert_eq!(wght.axis_tag(), Tag::new(b"wght")); assert_eq!(wght.min_value(), Fixed::from_f64(100.0)); assert_eq!(wght.default_value(), Fixed::from_f64(400.0)); @@ -70,7 +70,7 @@ mod tests { let instance = instances.get(i).unwrap(); assert_eq!(instance.coordinates.len(), 1); assert_eq!( - instance.coordinates.get(0).unwrap().get(), + instance.coordinates.first().unwrap().get(), Fixed::from_f64(value) ); assert_eq!(instance.subfamily_name_id, name_id); @@ -82,7 +82,7 @@ mod tests { fn normalize() { let font = FontRef::new(font_test_data::VAZIRMATN_VAR).unwrap(); let fvar = font.fvar().unwrap(); - let axis = fvar.axes().unwrap().get(0).unwrap(); + let axis = fvar.axes().unwrap().first().unwrap(); let values = [100.0, 220.0, 250.0, 400.0, 650.0, 900.0]; let expected = [-1.0, -0.60001, -0.5, 0.0, 0.5, 1.0]; for (value, expected) in values.into_iter().zip(expected) { diff --git a/write-fonts/src/lib.rs b/write-fonts/src/lib.rs index b5f4757bc..4c97e334f 100644 --- a/write-fonts/src/lib.rs +++ b/write-fonts/src/lib.rs @@ -151,6 +151,7 @@ pub extern crate font_types as types; pub extern crate read_fonts as read; /// types used in autogenerated code. +#[allow(unused_imports)] pub(crate) mod codegen_prelude { use std::num::TryFromIntError; diff --git a/write-fonts/src/tables/gvar/iup.rs b/write-fonts/src/tables/gvar/iup.rs index acadea5e3..420370a49 100644 --- a/write-fonts/src/tables/gvar/iup.rs +++ b/write-fonts/src/tables/gvar/iup.rs @@ -428,7 +428,7 @@ fn iup_contour_optimize( // Get the easy cases out of the way // Easy: all points are the same or there are no points // This covers the case when there is only one point - let Some(first_delta) = deltas.get(0) else { + let Some(first_delta) = deltas.first() else { return Ok(Vec::new()); }; if deltas.iter().all(|d| d == first_delta) {