From 105df973984b394c50bed53043973ef847cf7bf8 Mon Sep 17 00:00:00 2001 From: Lucas Jansen <7199136+staticintlucas@users.noreply.github.com> Date: Sat, 8 Jun 2024 01:06:02 +0100 Subject: [PATCH] Get rid of a few TODOs --- keyset-drawing/src/imp/key.rs | 2 +- keyset-drawing/src/imp/mod.rs | 2 +- keyset-drawing/src/pdf.rs | 2 +- keyset-font/src/face.rs | 2 +- keyset-font/src/lib.rs | 2 +- keyset-geom/src/path/arc_to_bezier.rs | 3 +-- keyset-geom/src/path/segment.rs | 2 +- keyset-key/src/kle/mod.rs | 1 - keyset-profile/src/lib.rs | 2 -- 9 files changed, 7 insertions(+), 11 deletions(-) diff --git a/keyset-drawing/src/imp/key.rs b/keyset-drawing/src/imp/key.rs index f82edc8..181648c 100644 --- a/keyset-drawing/src/imp/key.rs +++ b/keyset-drawing/src/imp/key.rs @@ -105,7 +105,7 @@ pub fn step(key: &key::Key, options: &Options<'_>) -> Option { // Take average dimensions of top and bottom let rect = { - let frac = 0.5; // TODO make this configurable? + let frac = 0.5; let top = profile.top_with_size(Size::new(1.0, 1.0)); let btm = profile.bottom_with_size(Size::new(1.0, 1.0)); RoundRect::new( diff --git a/keyset-drawing/src/imp/mod.rs b/keyset-drawing/src/imp/mod.rs index b891806..b14cc92 100644 --- a/keyset-drawing/src/imp/mod.rs +++ b/keyset-drawing/src/imp/mod.rs @@ -43,7 +43,7 @@ impl KeyDrawing { let top_rect = options.profile.top_with_rect(key.shape.inner_rect()).rect(); let margin = options.show_margin.then(|| { - // TODO get unique margins, not size_idx's. Currently impossible because SideOffsets: !Hash + // Cann't get unique margins because SideOffsets: !Hash, use unique size_idx's instead let sizes: HashSet<_> = key.legends.iter().flatten().map(|l| l.size_idx).collect(); let paths: Vec<_> = sizes .into_iter() diff --git a/keyset-drawing/src/pdf.rs b/keyset-drawing/src/pdf.rs index d169873..670abfe 100644 --- a/keyset-drawing/src/pdf.rs +++ b/keyset-drawing/src/pdf.rs @@ -152,7 +152,7 @@ fn draw_path(content: &mut Content, path: &KeyPath, transform: Transform { content.stroke(); } - (None, None) => {} // GRCOV_EXCL_LINE // TODO unreachable!() ? + (None, None) => {} // unreachable!() ? // it makes sense to just do nothing here regardless }; } diff --git a/keyset-font/src/face.rs b/keyset-font/src/face.rs index b5bb877..4137a7f 100644 --- a/keyset-font/src/face.rs +++ b/keyset-font/src/face.rs @@ -81,7 +81,7 @@ impl Face { .filter(|st| { st.horizontal // We only support LTR for the moment && !st.variable // We don't support variable fonts - && !st.has_cross_stream // TODO support this? + && !st.has_cross_stream // We don't support vertical adjustment && !st.has_state_machine // Not supported by ttf-parser }) .collect() diff --git a/keyset-font/src/lib.rs b/keyset-font/src/lib.rs index 50ee179..3ba1f74 100644 --- a/keyset-font/src/lib.rs +++ b/keyset-font/src/lib.rs @@ -35,7 +35,7 @@ impl Glyph { fn parse_from(face: &Face, gid: GlyphId) -> Option { struct PathBuilderWrapper(PathBuilder); - // GRCOV_EXCL_START // TODO these are pretty trivial but we could cover them in tests + // GRCOV_EXCL_START // these are trivial and I'm too lazy to write tests impl ttf_parser::OutlineBuilder for PathBuilderWrapper { fn move_to(&mut self, x: f32, y: f32) { self.0.abs_move(Point::new(x, y)); diff --git a/keyset-geom/src/path/arc_to_bezier.rs b/keyset-geom/src/path/arc_to_bezier.rs index 7835f6c..2e7c272 100644 --- a/keyset-geom/src/path/arc_to_bezier.rs +++ b/keyset-geom/src/path/arc_to_bezier.rs @@ -46,8 +46,7 @@ pub fn arc_to_bezier( _ => dphi, }; - // Double checks the quadrant of dphi - // TODO remove these? They shouldn't ever fail I think aside from the odd tolerance issue + // Double checks the quadrant of dphi. Shouldn't ever fail aside from maybe tolerance issues? match (laf, sf) { (false, false) => debug_assert!((-Angle::pi()..=Angle::zero()).contains(&dphi)), (false, true) => debug_assert!((Angle::zero()..=Angle::pi()).contains(&dphi)), diff --git a/keyset-geom/src/path/segment.rs b/keyset-geom/src/path/segment.rs index a63f4b5..501fd83 100644 --- a/keyset-geom/src/path/segment.rs +++ b/keyset-geom/src/path/segment.rs @@ -76,7 +76,7 @@ impl IsClose for PathSegment { rel_tol: impl Borrow, abs_tol: impl Borrow, ) -> bool { - // TODO need type hints here to help rust-analyzer + // TODO need type hints here to help rust-analyzer; see: rust-lang/rust-analyzer#5514 let (other, rel_tol, abs_tol): (&Self, &f32, &f32) = (other.borrow(), rel_tol.borrow(), abs_tol.borrow()); match (*self, *other) { diff --git a/keyset-key/src/kle/mod.rs b/keyset-key/src/kle/mod.rs index f10d409..c0036ad 100644 --- a/keyset-key/src/kle/mod.rs +++ b/keyset-key/src/kle/mod.rs @@ -53,7 +53,6 @@ fn shape_from_kle(key: &kle::Key) -> Result { } else if is_close(&dims, &ISO_HORIZ) { Ok(Shape::IsoHorizontal) } else { - // TODO arbitrary key shapes/sizes Err(Error::UnsupportedKeySize { w, h, diff --git a/keyset-profile/src/lib.rs b/keyset-profile/src/lib.rs index 9ef8431..42fd1b4 100644 --- a/keyset-profile/src/lib.rs +++ b/keyset-profile/src/lib.rs @@ -357,8 +357,6 @@ impl Profile { serde_json::from_str(s).map_err(de::Error::from) } - // TODO move the following to drawing?: - /// Get the key top rectangle for a given key size #[inline] #[must_use]