From 5dab7d9100be56d2e501d6c37b76dfcd0c3d57e6 Mon Sep 17 00:00:00 2001 From: Ellen Emilia Anna Zscheile Date: Sun, 2 Feb 2025 01:03:04 +0100 Subject: [PATCH] refactor(navcord): inline 'binavvertex', 'maybe_cw' helpers --- src/router/navcord.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/router/navcord.rs b/src/router/navcord.rs index 12cf669..daecc5e 100644 --- a/src/router/navcord.rs +++ b/src/router/navcord.rs @@ -61,9 +61,12 @@ impl NavcordStepper { head: Head, around: NavvertexIndex, ) -> Result { - let cw = Self::maybe_cw(navmesh, around).ok_or(NavcorderException::CannotWrap)?; + let around_node_weight = navmesh.node_weight(around).unwrap(); + let cw = around_node_weight + .maybe_cw + .ok_or(NavcorderException::CannotWrap)?; - match Self::binavvertex(navmesh, around) { + match around_node_weight.node { BinavvertexNodeIndex::FixedDot(dot) => { self.wrap_around_fixed_dot(layout, head, dot, cw) } @@ -93,14 +96,6 @@ impl NavcordStepper { ) -> Result { Ok(layout.cane_around_bend(&mut self.recorder, head, around.into(), cw, self.width)?) } - - fn binavvertex(navmesh: &Navmesh, navvertex: NavvertexIndex) -> BinavvertexNodeIndex { - navmesh.node_weight(navvertex).unwrap().node - } - - fn maybe_cw(navmesh: &Navmesh, navvertex: NavvertexIndex) -> Option { - navmesh.node_weight(navvertex).unwrap().maybe_cw - } } pub struct NavcordStepContext<'a, R> {