Skip to content

Commit

Permalink
Get rid of a few TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
staticintlucas committed Jun 8, 2024
1 parent 09546f4 commit 105df97
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion keyset-drawing/src/imp/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub fn step(key: &key::Key, options: &Options<'_>) -> Option<KeyPath> {

// 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(
Expand Down
2 changes: 1 addition & 1 deletion keyset-drawing/src/imp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion keyset-drawing/src/pdf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ fn draw_path(content: &mut Content, path: &KeyPath, transform: Transform<Dot, Pd
(None, Some(_)) => {
content.stroke();
}
(None, None) => {} // GRCOV_EXCL_LINE // TODO unreachable!() ?
(None, None) => {} // unreachable!() ? // it makes sense to just do nothing here regardless
};
}

Expand Down
2 changes: 1 addition & 1 deletion keyset-font/src/face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion keyset-font/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl Glyph {
fn parse_from(face: &Face, gid: GlyphId) -> Option<Self> {
struct PathBuilderWrapper(PathBuilder<FontUnit>);

// 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));
Expand Down
3 changes: 1 addition & 2 deletions keyset-geom/src/path/arc_to_bezier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ pub fn arc_to_bezier<U>(
_ => 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)),
Expand Down
2 changes: 1 addition & 1 deletion keyset-geom/src/path/segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl<U> IsClose<f32> for PathSegment<U> {
rel_tol: impl Borrow<f32>,
abs_tol: impl Borrow<f32>,
) -> 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) {
Expand Down
1 change: 0 additions & 1 deletion keyset-key/src/kle/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ fn shape_from_kle(key: &kle::Key) -> Result<Shape> {
} else if is_close(&dims, &ISO_HORIZ) {
Ok(Shape::IsoHorizontal)
} else {
// TODO arbitrary key shapes/sizes
Err(Error::UnsupportedKeySize {
w,
h,
Expand Down
2 changes: 0 additions & 2 deletions keyset-profile/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 105df97

Please sign in to comment.