diff --git a/src/board/mod.rs b/src/board/mod.rs index 567163a..227b76a 100644 --- a/src/board/mod.rs +++ b/src/board/mod.rs @@ -82,9 +82,9 @@ impl Board { ) -> FixedDotIndex { let dot = self.layout.add_fixed_dot_infringably(recorder, weight); - if let Some(ref pin) = maybe_pin { + if let Some(pin) = maybe_pin { self.node_to_pinname - .insert(GenericNode::Primitive(dot.into()), pin.clone()); + .insert(GenericNode::Primitive(dot.into()), pin); } dot @@ -128,7 +128,7 @@ impl Board { if let Some(pin) = maybe_pin { self.node_to_pinname - .insert(GenericNode::Primitive(seg.into()), pin.to_string()); + .insert(GenericNode::Primitive(seg.into()), pin); } seg @@ -170,7 +170,7 @@ impl Board { if let Some(pin) = maybe_pin { self.node_to_pinname - .insert(GenericNode::Compound(poly.into()), pin.to_string()); + .insert(GenericNode::Compound(poly.into()), pin); } poly @@ -184,18 +184,19 @@ impl Board { recorder: &mut LayoutEdit, poly: GenericIndex, ) -> FixedDotIndex { - if let Some(apex) = self.layout.poly(poly).maybe_apex() { + let resolved_poly = self.layout.poly(poly); + if let Some(apex) = resolved_poly.maybe_apex() { apex } else { self.add_poly_fixed_dot_infringably( recorder, FixedDotWeight { circle: Circle { - pos: self.layout.poly(poly).shape().center(), + pos: resolved_poly.shape().center(), r: 100.0, }, - layer: self.layout.poly(poly).layer(), - maybe_net: self.layout.poly(poly).maybe_net(), + layer: resolved_poly.layer(), + maybe_net: resolved_poly.maybe_net(), }, poly, ) @@ -240,14 +241,10 @@ impl Board { pub fn band_between_pins(&self, pinname1: &str, pinname2: &str) -> Option { if let Some(band) = self .band_bandname + // note: it doesn't matter in what order pinnames are given, the constructor sorts them .get_by_right(&BandName::new(pinname1.to_string(), pinname2.to_string())) { Some(*band) - } else if let Some(band) = self - .band_bandname - .get_by_right(&BandName::new(pinname2.to_string(), pinname1.to_string())) - { - Some(*band) } else { None } diff --git a/src/router/route.rs b/src/router/route.rs index b51114e..237d129 100644 --- a/src/router/route.rs +++ b/src/router/route.rs @@ -35,7 +35,7 @@ impl RouteStepper { to: FixedDotIndex, width: f64, ) -> Result { - let navmesh = Navmesh::new(router.layout(), from, to, router.options().clone())?; + let navmesh = Navmesh::new(router.layout(), from, to, *router.options())?; Ok(Self::new_from_navmesh(router, recorder, navmesh, width)) } diff --git a/src/specctra/design.rs b/src/specctra/design.rs index c41b8dc..fc4cf5e 100644 --- a/src/specctra/design.rs +++ b/src/specctra/design.rs @@ -448,7 +448,7 @@ impl SpecctraDesign { layer, maybe_net, }, - maybe_pin.clone(), + maybe_pin, ); } @@ -468,7 +468,7 @@ impl SpecctraDesign { let poly = board.add_poly( recorder, SolidPolyWeight { layer, maybe_net }.into(), - maybe_pin.clone(), + maybe_pin, ); // Corners. @@ -646,7 +646,7 @@ impl SpecctraDesign { let poly = board.add_poly( recorder, SolidPolyWeight { layer, maybe_net }.into(), - maybe_pin.clone(), + maybe_pin, ); // add the first coordinate in the wire path as a dot and save its index