chore: apply clippy fixes

This commit is contained in:
Ellen Emilia Anna Zscheile 2025-03-25 00:16:05 +01:00
parent 8e3be44e18
commit 670ddbe1f7
17 changed files with 77 additions and 90 deletions

View File

@ -96,7 +96,7 @@ impl PinSelection {
} }
pub fn contains_node(&self, board: &Board<impl AccessMesadata>, node: NodeIndex) -> bool { pub fn contains_node(&self, board: &Board<impl AccessMesadata>, node: NodeIndex) -> bool {
PinSelector::try_from_node(board, node).map_or(false, |selector| self.0.contains(&selector)) PinSelector::try_from_node(board, node).is_some_and(|selector| self.0.contains(&selector))
} }
pub fn selectors(&self) -> impl Iterator<Item = &PinSelector> { pub fn selectors(&self) -> impl Iterator<Item = &PinSelector> {
@ -148,8 +148,7 @@ impl BandSelection {
} }
pub fn contains_node(&self, board: &Board<impl AccessMesadata>, node: NodeIndex) -> bool { pub fn contains_node(&self, board: &Board<impl AccessMesadata>, node: NodeIndex) -> bool {
BandSelector::try_from_node(board, node) BandSelector::try_from_node(board, node).is_some_and(|selector| self.0.contains(&selector))
.map_or(false, |selector| self.0.contains(&selector))
} }
pub fn selectors(&self) -> impl Iterator<Item = &BandSelector> { pub fn selectors(&self) -> impl Iterator<Item = &BandSelector> {
@ -222,7 +221,7 @@ impl Selection {
// 2. restrict to complete matches, return associated keys // 2. restrict to complete matches, return associated keys
selectors selectors
.into_iter() .into_iter()
.filter(|(_, nis)| &nis.0 == &nis.1) .filter(|(_, nis)| nis.0 == nis.1)
.map(|(k, _)| k) .map(|(k, _)| k)
.collect::<BTreeSet<_>>() .collect::<BTreeSet<_>>()
} }

View File

@ -64,12 +64,10 @@ impl<'a> ResolvedSelector<'a> {
if let Some(pin_name) = board.node_pinname(&node) { if let Some(pin_name) = board.node_pinname(&node) {
Some(ResolvedSelector::Pin { pin_name, layer }) Some(ResolvedSelector::Pin { pin_name, layer })
} else if let Some(loose) = loose { } else {
Some(ResolvedSelector::Band { loose.map(|loose| ResolvedSelector::Band {
band_uid: board.layout().drawing().loose_band_uid(loose), band_uid: board.layout().drawing().loose_band_uid(loose),
}) })
} else {
None
} }
} }
} }

View File

@ -54,7 +54,7 @@ impl<'a, CW, R> BandRef<'a, CW, R> {
} }
} }
impl<'a, CW: Copy, R: AccessRules> MeasureLength for BandRef<'a, CW, R> { impl<CW: Copy, R: AccessRules> MeasureLength for BandRef<'_, CW, R> {
fn length(&self) -> f64 { fn length(&self) -> f64 {
match self.first_seg { match self.first_seg {
BandTermsegIndex::Straight(seg) => { BandTermsegIndex::Straight(seg) => {

View File

@ -72,19 +72,19 @@ impl<'a, CW: Copy, R: AccessRules> GearRef<'a, CW, R> {
} }
} }
impl<'a, CW: Copy, R: AccessRules> GetNextGear for FixedDot<'a, CW, R> { impl<CW: Copy, R: AccessRules> GetNextGear for FixedDot<'_, CW, R> {
fn next_gear(&self) -> Option<LooseBendIndex> { fn next_gear(&self) -> Option<LooseBendIndex> {
self.first_gear() self.first_gear()
} }
} }
impl<'a, CW: Copy, R: AccessRules> GetNextGear for LooseBend<'a, CW, R> { impl<CW: Copy, R: AccessRules> GetNextGear for LooseBend<'_, CW, R> {
fn next_gear(&self) -> Option<LooseBendIndex> { fn next_gear(&self) -> Option<LooseBendIndex> {
self.outer() self.outer()
} }
} }
impl<'a, CW: Copy, R: AccessRules> GetNextGear for FixedBend<'a, CW, R> { impl<CW: Copy, R: AccessRules> GetNextGear for FixedBend<'_, CW, R> {
fn next_gear(&self) -> Option<LooseBendIndex> { fn next_gear(&self) -> Option<LooseBendIndex> {
self.first_gear() self.first_gear()
} }

View File

@ -82,13 +82,13 @@ impl<'a, CW, R> HeadRef<'a, CW, R> {
} }
} }
impl<'a, CW, R> GetFace for HeadRef<'a, CW, R> { impl<CW, R> GetFace for HeadRef<'_, CW, R> {
fn face(&self) -> DotIndex { fn face(&self) -> DotIndex {
self.head.face() self.head.face()
} }
} }
impl<'a, CW: Copy, R: AccessRules> MeasureLength for HeadRef<'a, CW, R> { impl<CW: Copy, R: AccessRules> MeasureLength for HeadRef<'_, CW, R> {
fn length(&self) -> f64 { fn length(&self) -> f64 {
match self.head { match self.head {
Head::Bare(..) => 0.0, Head::Bare(..) => 0.0,

View File

@ -27,10 +27,10 @@ pub trait GetPrevNextLoose {
// when `maybe_*` is `Some(_)`, // when `maybe_*` is `Some(_)`,
// but otherwise, they start in opposite direction, here by going via: // but otherwise, they start in opposite direction, here by going via:
let maybe_prev = maybe_next.or_else(|| { let maybe_prev = maybe_next.or_else(|| {
let default_neighbor = self.next_loose(None); // default_neighbor =
self.next_loose(None)
// * normally, one would retrieve the next element via `default_neighbor.next_loose(self)` // * normally, one would retrieve the next element via `default_neighbor.next_loose(self)`
// * `self.next_loose(default_neighbor)` on the other hand inverts the direction we're iterating towards. // * `self.next_loose(default_neighbor)` on the other hand inverts the direction we're iterating towards.
default_neighbor
}); });
self.next_loose(maybe_prev) self.next_loose(maybe_prev)
} }
@ -88,7 +88,7 @@ impl<'a, CW: Copy, R: AccessRules> Loose<'a, CW, R> {
} }
} }
impl<'a, CW: Copy, R: AccessRules> GetPrevNextLoose for LooseDot<'a, CW, R> { impl<CW: Copy, R: AccessRules> GetPrevNextLoose for LooseDot<'_, CW, R> {
fn next_loose(&self, maybe_prev: Option<LooseIndex>) -> Option<LooseIndex> { fn next_loose(&self, maybe_prev: Option<LooseIndex>) -> Option<LooseIndex> {
let bend = self.bend(); let bend = self.bend();
@ -104,13 +104,13 @@ impl<'a, CW: Copy, R: AccessRules> GetPrevNextLoose for LooseDot<'a, CW, R> {
} }
} }
impl<'a, CW: Copy, R: AccessRules> GetPrevNextLoose for LoneLooseSeg<'a, CW, R> { impl<CW: Copy, R: AccessRules> GetPrevNextLoose for LoneLooseSeg<'_, CW, R> {
fn next_loose(&self, _maybe_prev: Option<LooseIndex>) -> Option<LooseIndex> { fn next_loose(&self, _maybe_prev: Option<LooseIndex>) -> Option<LooseIndex> {
None None
} }
} }
impl<'a, CW: Copy, R: AccessRules> GetPrevNextLoose for SeqLooseSeg<'a, CW, R> { impl<CW: Copy, R: AccessRules> GetPrevNextLoose for SeqLooseSeg<'_, CW, R> {
fn next_loose(&self, maybe_prev: Option<LooseIndex>) -> Option<LooseIndex> { fn next_loose(&self, maybe_prev: Option<LooseIndex>) -> Option<LooseIndex> {
let joints = self.joints(); let joints = self.joints();
let Some(prev) = maybe_prev else { let Some(prev) = maybe_prev else {
@ -128,7 +128,7 @@ impl<'a, CW: Copy, R: AccessRules> GetPrevNextLoose for SeqLooseSeg<'a, CW, R> {
} }
} }
impl<'a, CW: Copy, R: AccessRules> GetPrevNextLoose for LooseBend<'a, CW, R> { impl<CW: Copy, R: AccessRules> GetPrevNextLoose for LooseBend<'_, CW, R> {
fn next_loose(&self, maybe_prev: Option<LooseIndex>) -> Option<LooseIndex> { fn next_loose(&self, maybe_prev: Option<LooseIndex>) -> Option<LooseIndex> {
let joints = self.joints(); let joints = self.joints();

View File

@ -93,7 +93,7 @@ pub trait GetCore: GetBendIndex {
fn core(&self) -> FixedDotIndex; fn core(&self) -> FixedDotIndex;
} }
impl<'a, S: GetDrawing + GetBendIndex> GetCore for S { impl<S: GetDrawing + GetBendIndex> GetCore for S {
fn core(&self) -> FixedDotIndex { fn core(&self) -> FixedDotIndex {
FixedDotIndex::new( FixedDotIndex::new(
self.drawing() self.drawing()
@ -106,9 +106,7 @@ impl<'a, S: GetDrawing + GetBendIndex> GetCore for S {
macro_rules! impl_primitive { macro_rules! impl_primitive {
($primitive_struct:ident, $weight_struct:ident) => { ($primitive_struct:ident, $weight_struct:ident) => {
impl<'a, CW: Copy, R: AccessRules> GetWeight<$weight_struct> impl<CW: Copy, R: AccessRules> GetWeight<$weight_struct> for $primitive_struct<'_, CW, R> {
for $primitive_struct<'a, CW, R>
{
fn weight(&self) -> $weight_struct { fn weight(&self) -> $weight_struct {
if let PrimitiveWeight::$primitive_struct(weight) = self.tagged_weight() { if let PrimitiveWeight::$primitive_struct(weight) = self.tagged_weight() {
weight weight
@ -118,13 +116,13 @@ macro_rules! impl_primitive {
} }
} }
impl<'a, CW: Copy, R: AccessRules> GetLayer for $primitive_struct<'a, CW, R> { impl<CW: Copy, R: AccessRules> GetLayer for $primitive_struct<'_, CW, R> {
fn layer(&self) -> usize { fn layer(&self) -> usize {
self.weight().layer() self.weight().layer()
} }
} }
impl<'a, CW: Copy, R: AccessRules> GetMaybeNet for $primitive_struct<'a, CW, R> { impl<CW: Copy, R: AccessRules> GetMaybeNet for $primitive_struct<'_, CW, R> {
fn maybe_net(&self) -> Option<usize> { fn maybe_net(&self) -> Option<usize> {
self.weight().maybe_net() self.weight().maybe_net()
} }
@ -202,22 +200,20 @@ impl<'a, W, CW: Copy, R: AccessRules> GenericPrimitive<'a, W, CW, R> {
} }
} }
impl<'a, W, CW: Copy, R: AccessRules> GetInterior<PrimitiveIndex> impl<W, CW: Copy, R: AccessRules> GetInterior<PrimitiveIndex> for GenericPrimitive<'_, W, CW, R> {
for GenericPrimitive<'a, W, CW, R>
{
fn interior(&self) -> Vec<PrimitiveIndex> { fn interior(&self) -> Vec<PrimitiveIndex> {
vec![self.tagged_weight().retag(self.index.petgraph_index())] vec![self.tagged_weight().retag(self.index.petgraph_index())]
} }
} }
impl<'a, W, CW: Copy, R: AccessRules> GetDrawing for GenericPrimitive<'a, W, CW, R> { impl<W, CW: Copy, R: AccessRules> GetDrawing for GenericPrimitive<'_, W, CW, R> {
type Rules = R; type Rules = R;
fn drawing(&self) -> &Drawing<impl Copy, R> { fn drawing(&self) -> &Drawing<impl Copy, R> {
self.drawing self.drawing
} }
} }
impl<'a, W, CW: Copy, R: AccessRules> GetPetgraphIndex for GenericPrimitive<'a, W, CW, R> { impl<W, CW: Copy, R: AccessRules> GetPetgraphIndex for GenericPrimitive<'_, W, CW, R> {
fn petgraph_index(&self) -> NodeIndex<usize> { fn petgraph_index(&self) -> NodeIndex<usize> {
self.index.petgraph_index() self.index.petgraph_index()
} }
@ -248,13 +244,13 @@ where
pub type FixedDot<'a, CW, R> = GenericPrimitive<'a, FixedDotWeight, CW, R>; pub type FixedDot<'a, CW, R> = GenericPrimitive<'a, FixedDotWeight, CW, R>;
impl_fixed_primitive!(FixedDot, FixedDotWeight); impl_fixed_primitive!(FixedDot, FixedDotWeight);
impl<'a, CW: Copy, R: AccessRules> MakePrimitiveShape for FixedDot<'a, CW, R> { impl<CW: Copy, R: AccessRules> MakePrimitiveShape for FixedDot<'_, CW, R> {
fn shape(&self) -> PrimitiveShape { fn shape(&self) -> PrimitiveShape {
self.drawing.geometry().dot_shape(self.index.into()) self.drawing.geometry().dot_shape(self.index.into())
} }
} }
impl<'a, CW: Copy, R: AccessRules> GetLimbs for FixedDot<'a, CW, R> { impl<CW: Copy, R: AccessRules> GetLimbs for FixedDot<'_, CW, R> {
fn segs(&self) -> Vec<SegIndex> { fn segs(&self) -> Vec<SegIndex> {
self.drawing self.drawing
.geometry() .geometry()
@ -270,12 +266,12 @@ impl<'a, CW: Copy, R: AccessRules> GetLimbs for FixedDot<'a, CW, R> {
} }
} }
impl<'a, CW: Copy, R: AccessRules> GetFirstGear for FixedDot<'a, CW, R> {} impl<CW: Copy, R: AccessRules> GetFirstGear for FixedDot<'_, CW, R> {}
pub type LooseDot<'a, CW, R> = GenericPrimitive<'a, LooseDotWeight, CW, R>; pub type LooseDot<'a, CW, R> = GenericPrimitive<'a, LooseDotWeight, CW, R>;
impl_loose_primitive!(LooseDot, LooseDotWeight); impl_loose_primitive!(LooseDot, LooseDotWeight);
impl<'a, CW: Copy, R: AccessRules> LooseDot<'a, CW, R> { impl<CW: Copy, R: AccessRules> LooseDot<'_, CW, R> {
pub fn seg(&self) -> Option<SeqLooseSegIndex> { pub fn seg(&self) -> Option<SeqLooseSegIndex> {
self.drawing self.drawing
.geometry() .geometry()
@ -294,13 +290,13 @@ impl<'a, CW: Copy, R: AccessRules> LooseDot<'a, CW, R> {
} }
} }
impl<'a, CW: Copy, R: AccessRules> MakePrimitiveShape for LooseDot<'a, CW, R> { impl<CW: Copy, R: AccessRules> MakePrimitiveShape for LooseDot<'_, CW, R> {
fn shape(&self) -> PrimitiveShape { fn shape(&self) -> PrimitiveShape {
self.drawing.geometry().dot_shape(self.index.into()) self.drawing.geometry().dot_shape(self.index.into())
} }
} }
impl<'a, CW: Copy, R: AccessRules> GetLimbs for LooseDot<'a, CW, R> { impl<CW: Copy, R: AccessRules> GetLimbs for LooseDot<'_, CW, R> {
fn segs(&self) -> Vec<SegIndex> { fn segs(&self) -> Vec<SegIndex> {
if let Some(seg) = self.seg() { if let Some(seg) = self.seg() {
vec![seg.into()] vec![seg.into()]
@ -317,15 +313,15 @@ impl<'a, CW: Copy, R: AccessRules> GetLimbs for LooseDot<'a, CW, R> {
pub type FixedSeg<'a, CW, R> = GenericPrimitive<'a, FixedSegWeight, CW, R>; pub type FixedSeg<'a, CW, R> = GenericPrimitive<'a, FixedSegWeight, CW, R>;
impl_fixed_primitive!(FixedSeg, FixedSegWeight); impl_fixed_primitive!(FixedSeg, FixedSegWeight);
impl<'a, CW: Copy, R: AccessRules> MakePrimitiveShape for FixedSeg<'a, CW, R> { impl<CW: Copy, R: AccessRules> MakePrimitiveShape for FixedSeg<'_, CW, R> {
fn shape(&self) -> PrimitiveShape { fn shape(&self) -> PrimitiveShape {
self.drawing.geometry().seg_shape(self.index.into()) self.drawing.geometry().seg_shape(self.index.into())
} }
} }
impl<'a, CW: Copy, R: AccessRules> GetLimbs for FixedSeg<'a, CW, R> {} impl<CW: Copy, R: AccessRules> GetLimbs for FixedSeg<'_, CW, R> {}
impl<'a, CW: Copy, R: AccessRules> GetJoints<FixedDotIndex, FixedDotIndex> for FixedSeg<'a, CW, R> { impl<CW: Copy, R: AccessRules> GetJoints<FixedDotIndex, FixedDotIndex> for FixedSeg<'_, CW, R> {
fn joints(&self) -> (FixedDotIndex, FixedDotIndex) { fn joints(&self) -> (FixedDotIndex, FixedDotIndex) {
let (from, to) = self.drawing.geometry().seg_joints(self.index.into()); let (from, to) = self.drawing.geometry().seg_joints(self.index.into());
( (
@ -338,17 +334,15 @@ impl<'a, CW: Copy, R: AccessRules> GetJoints<FixedDotIndex, FixedDotIndex> for F
pub type LoneLooseSeg<'a, CW, R> = GenericPrimitive<'a, LoneLooseSegWeight, CW, R>; pub type LoneLooseSeg<'a, CW, R> = GenericPrimitive<'a, LoneLooseSegWeight, CW, R>;
impl_loose_primitive!(LoneLooseSeg, LoneLooseSegWeight); impl_loose_primitive!(LoneLooseSeg, LoneLooseSegWeight);
impl<'a, CW: Copy, R: AccessRules> MakePrimitiveShape for LoneLooseSeg<'a, CW, R> { impl<CW: Copy, R: AccessRules> MakePrimitiveShape for LoneLooseSeg<'_, CW, R> {
fn shape(&self) -> PrimitiveShape { fn shape(&self) -> PrimitiveShape {
self.drawing.geometry().seg_shape(self.index.into()) self.drawing.geometry().seg_shape(self.index.into())
} }
} }
impl<'a, CW: Copy, R: AccessRules> GetLimbs for LoneLooseSeg<'a, CW, R> {} impl<CW: Copy, R: AccessRules> GetLimbs for LoneLooseSeg<'_, CW, R> {}
impl<'a, CW: Copy, R: AccessRules> GetJoints<FixedDotIndex, FixedDotIndex> impl<CW: Copy, R: AccessRules> GetJoints<FixedDotIndex, FixedDotIndex> for LoneLooseSeg<'_, CW, R> {
for LoneLooseSeg<'a, CW, R>
{
fn joints(&self) -> (FixedDotIndex, FixedDotIndex) { fn joints(&self) -> (FixedDotIndex, FixedDotIndex) {
let (from, to) = self.drawing.geometry().seg_joints(self.index.into()); let (from, to) = self.drawing.geometry().seg_joints(self.index.into());
( (
@ -361,15 +355,15 @@ impl<'a, CW: Copy, R: AccessRules> GetJoints<FixedDotIndex, FixedDotIndex>
pub type SeqLooseSeg<'a, CW, R> = GenericPrimitive<'a, SeqLooseSegWeight, CW, R>; pub type SeqLooseSeg<'a, CW, R> = GenericPrimitive<'a, SeqLooseSegWeight, CW, R>;
impl_loose_primitive!(SeqLooseSeg, SeqLooseSegWeight); impl_loose_primitive!(SeqLooseSeg, SeqLooseSegWeight);
impl<'a, CW: Copy, R: AccessRules> MakePrimitiveShape for SeqLooseSeg<'a, CW, R> { impl<CW: Copy, R: AccessRules> MakePrimitiveShape for SeqLooseSeg<'_, CW, R> {
fn shape(&self) -> PrimitiveShape { fn shape(&self) -> PrimitiveShape {
self.drawing.geometry().seg_shape(self.index.into()) self.drawing.geometry().seg_shape(self.index.into())
} }
} }
impl<'a, CW: Copy, R: AccessRules> GetLimbs for SeqLooseSeg<'a, CW, R> {} impl<CW: Copy, R: AccessRules> GetLimbs for SeqLooseSeg<'_, CW, R> {}
impl<'a, CW: Copy, R: AccessRules> GetJoints<DotIndex, LooseDotIndex> for SeqLooseSeg<'a, CW, R> { impl<CW: Copy, R: AccessRules> GetJoints<DotIndex, LooseDotIndex> for SeqLooseSeg<'_, CW, R> {
fn joints(&self) -> (DotIndex, LooseDotIndex) { fn joints(&self) -> (DotIndex, LooseDotIndex) {
let joints = self.drawing.geometry().seg_joints(self.index.into()); let joints = self.drawing.geometry().seg_joints(self.index.into());
if let DotWeight::Fixed(..) = self.drawing.geometry().dot_weight(joints.0) { if let DotWeight::Fixed(..) = self.drawing.geometry().dot_weight(joints.0) {
@ -394,23 +388,21 @@ impl<'a, CW: Copy, R: AccessRules> GetJoints<DotIndex, LooseDotIndex> for SeqLoo
pub type FixedBend<'a, CW, R> = GenericPrimitive<'a, FixedBendWeight, CW, R>; pub type FixedBend<'a, CW, R> = GenericPrimitive<'a, FixedBendWeight, CW, R>;
impl_fixed_primitive!(FixedBend, FixedBendWeight); impl_fixed_primitive!(FixedBend, FixedBendWeight);
impl<'a, CW: Copy, R: AccessRules> GetBendIndex for FixedBend<'a, CW, R> { impl<CW: Copy, R: AccessRules> GetBendIndex for FixedBend<'_, CW, R> {
fn bend_index(&self) -> BendIndex { fn bend_index(&self) -> BendIndex {
self.index.into() self.index.into()
} }
} }
impl<'a, CW: Copy, R: AccessRules> MakePrimitiveShape for FixedBend<'a, CW, R> { impl<CW: Copy, R: AccessRules> MakePrimitiveShape for FixedBend<'_, CW, R> {
fn shape(&self) -> PrimitiveShape { fn shape(&self) -> PrimitiveShape {
self.drawing.geometry().bend_shape(self.index.into()) self.drawing.geometry().bend_shape(self.index.into())
} }
} }
impl<'a, CW: Copy, R: AccessRules> GetLimbs for FixedBend<'a, CW, R> {} impl<CW: Copy, R: AccessRules> GetLimbs for FixedBend<'_, CW, R> {}
impl<'a, CW: Copy, R: AccessRules> GetJoints<FixedDotIndex, FixedDotIndex> impl<CW: Copy, R: AccessRules> GetJoints<FixedDotIndex, FixedDotIndex> for FixedBend<'_, CW, R> {
for FixedBend<'a, CW, R>
{
fn joints(&self) -> (FixedDotIndex, FixedDotIndex) { fn joints(&self) -> (FixedDotIndex, FixedDotIndex) {
let (from, to) = self.drawing.geometry().bend_joints(self.index.into()); let (from, to) = self.drawing.geometry().bend_joints(self.index.into());
( (
@ -420,13 +412,13 @@ impl<'a, CW: Copy, R: AccessRules> GetJoints<FixedDotIndex, FixedDotIndex>
} }
} }
impl<'a, CW: Copy, R: AccessRules> GetFirstGear for FixedBend<'a, CW, R> {} impl<CW: Copy, R: AccessRules> GetFirstGear for FixedBend<'_, CW, R> {}
//impl<'a, R: QueryRules> GetInnerOuter for FixedBend<'a, CW, R> {} //impl<'a, R: QueryRules> GetInnerOuter for FixedBend<'a, CW, R> {}
pub type LooseBend<'a, CW, R> = GenericPrimitive<'a, LooseBendWeight, CW, R>; pub type LooseBend<'a, CW, R> = GenericPrimitive<'a, LooseBendWeight, CW, R>;
impl_loose_primitive!(LooseBend, LooseBendWeight); impl_loose_primitive!(LooseBend, LooseBendWeight);
impl<'a, CW: Copy, R: AccessRules> GetBendIndex for LooseBend<'a, CW, R> { impl<CW: Copy, R: AccessRules> GetBendIndex for LooseBend<'_, CW, R> {
fn bend_index(&self) -> BendIndex { fn bend_index(&self) -> BendIndex {
self.index.into() self.index.into()
} }
@ -438,23 +430,21 @@ impl<'a, CW: Copy, R: AccessRules> From<LooseBend<'a, CW, R>> for BendIndex {
} }
} }
impl<'a, CW: Copy, R: AccessRules> MakePrimitiveShape for LooseBend<'a, CW, R> { impl<CW: Copy, R: AccessRules> MakePrimitiveShape for LooseBend<'_, CW, R> {
fn shape(&self) -> PrimitiveShape { fn shape(&self) -> PrimitiveShape {
self.drawing.geometry().bend_shape(self.index.into()) self.drawing.geometry().bend_shape(self.index.into())
} }
} }
impl<'a, CW: Copy, R: AccessRules> GetLimbs for LooseBend<'a, CW, R> {} impl<CW: Copy, R: AccessRules> GetLimbs for LooseBend<'_, CW, R> {}
impl<'a, CW: Copy, R: AccessRules> GetOffset for LooseBend<'a, CW, R> { impl<CW: Copy, R: AccessRules> GetOffset for LooseBend<'_, CW, R> {
fn offset(&self) -> f64 { fn offset(&self) -> f64 {
self.weight().offset() self.weight().offset()
} }
} }
impl<'a, CW: Copy, R: AccessRules> GetJoints<LooseDotIndex, LooseDotIndex> impl<CW: Copy, R: AccessRules> GetJoints<LooseDotIndex, LooseDotIndex> for LooseBend<'_, CW, R> {
for LooseBend<'a, CW, R>
{
fn joints(&self) -> (LooseDotIndex, LooseDotIndex) { fn joints(&self) -> (LooseDotIndex, LooseDotIndex) {
let (from, to) = self.drawing.geometry().bend_joints(self.index.into()); let (from, to) = self.drawing.geometry().bend_joints(self.index.into());
( (
@ -464,7 +454,7 @@ impl<'a, CW: Copy, R: AccessRules> GetJoints<LooseDotIndex, LooseDotIndex>
} }
} }
impl<'a, CW: Copy, R: AccessRules> LooseBend<'a, CW, R> { impl<CW: Copy, R: AccessRules> LooseBend<'_, CW, R> {
pub fn inner(&self) -> Option<LooseBendIndex> { pub fn inner(&self) -> Option<LooseBendIndex> {
self.drawing() self.drawing()
.geometry() .geometry()

View File

@ -97,6 +97,12 @@ pub struct Geometry<PW, DW, SW, BW, CW, PI, DI, SI, BI> {
bend_index_marker: PhantomData<BI>, bend_index_marker: PhantomData<BI>,
} }
impl<PW, DW, SW, BW, CW, PI, DI, SI, BI> Default for Geometry<PW, DW, SW, BW, CW, PI, DI, SI, BI> {
fn default() -> Self {
Self::new()
}
}
impl<PW, DW, SW, BW, CW, PI, DI, SI, BI> Geometry<PW, DW, SW, BW, CW, PI, DI, SI, BI> { impl<PW, DW, SW, BW, CW, PI, DI, SI, BI> Geometry<PW, DW, SW, BW, CW, PI, DI, SI, BI> {
pub fn new() -> Self { pub fn new() -> Self {
Self { Self {

View File

@ -312,13 +312,11 @@ impl<
} }
} }
fn edit_remove_from_map<I: Ord, T>( fn edit_remove_from_map<I: Eq + Ord, T>(
map: &mut std::collections::BTreeMap<I, (Option<T>, Option<T>)>, map: &mut std::collections::BTreeMap<I, (Option<T>, Option<T>)>,
index: I, index: I,
data: T, data: T,
) where ) {
I: core::cmp::Eq + Ord,
{
let to_be_inserted = (Some(data), None); let to_be_inserted = (Some(data), None);
match map.entry(index) { match map.entry(index) {
BTreeMapEntry::Occupied(mut occ) => { BTreeMapEntry::Occupied(mut occ) => {

View File

@ -41,10 +41,7 @@ impl<W> GenericIndex<W> {
impl<W> core::clone::Clone for GenericIndex<W> { impl<W> core::clone::Clone for GenericIndex<W> {
#[inline] #[inline]
fn clone(&self) -> Self { fn clone(&self) -> Self {
Self { *self
node_index: self.node_index,
marker: PhantomData,
}
} }
} }
@ -67,9 +64,9 @@ impl<W> PartialEq for GenericIndex<W> {
impl<W> Eq for GenericIndex<W> {} impl<W> Eq for GenericIndex<W> {}
impl<W> PartialOrd for GenericIndex<W> { impl<W> PartialOrd for GenericIndex<W> {
#[inline] #[inline(always)]
fn partial_cmp(&self, other: &Self) -> Option<Ordering> { fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
self.node_index.partial_cmp(&other.node_index) Some(self.cmp(other))
} }
} }

View File

@ -30,7 +30,7 @@ pub enum InteractionStepper {
// - interactively moving a footprint. // - interactively moving a footprint.
} }
impl<'a, M: AccessMesadata> Step<ActivityContext<'a, M>, String> for InteractionStepper { impl<M: AccessMesadata> Step<ActivityContext<'_, M>, String> for InteractionStepper {
type Error = InteractionError; type Error = InteractionError;
fn step( fn step(
@ -41,7 +41,7 @@ impl<'a, M: AccessMesadata> Step<ActivityContext<'a, M>, String> for Interaction
} }
} }
impl<'a, M: AccessMesadata> Abort<ActivityContext<'a, M>> for InteractionStepper { impl<M: AccessMesadata> Abort<ActivityContext<'_, M>> for InteractionStepper {
fn abort(&mut self, _context: &mut ActivityContext<M>) { fn abort(&mut self, _context: &mut ActivityContext<M>) {
todo!(); todo!();
} }

View File

@ -384,8 +384,8 @@ impl<R: AccessRules> Layout<R> {
end: right_pos.into(), end: right_pos.into(),
}; };
let fake_seg = SegShape { let fake_seg = SegShape {
from: left_pos.into(), from: left_pos,
to: right_pos.into(), to: right_pos,
width: f64::EPSILON * 16.0, width: f64::EPSILON * 16.0,
}; };
let mut orig_hline = NormalLine::from(ltr_line); let mut orig_hline = NormalLine::from(ltr_line);

View File

@ -54,7 +54,7 @@ impl<'a, R: AccessRules> Poly<'a, R> {
} }
} }
impl<'a, R: AccessRules> GetLayer for Poly<'a, R> { impl<R: AccessRules> GetLayer for Poly<'_, R> {
fn layer(&self) -> usize { fn layer(&self) -> usize {
if let CompoundWeight::Poly(weight) = self.drawing.compound_weight(self.index.into()) { if let CompoundWeight::Poly(weight) = self.drawing.compound_weight(self.index.into()) {
weight.layer() weight.layer()
@ -64,13 +64,13 @@ impl<'a, R: AccessRules> GetLayer for Poly<'a, R> {
} }
} }
impl<'a, R: AccessRules> GetMaybeNet for Poly<'a, R> { impl<R: AccessRules> GetMaybeNet for Poly<'_, R> {
fn maybe_net(&self) -> Option<usize> { fn maybe_net(&self) -> Option<usize> {
self.drawing.compound_weight(self.index.into()).maybe_net() self.drawing.compound_weight(self.index.into()).maybe_net()
} }
} }
impl<'a, R: AccessRules> MakePolygon for Poly<'a, R> { impl<R: AccessRules> MakePolygon for Poly<'_, R> {
fn shape(&self) -> Polygon { fn shape(&self) -> Polygon {
Polygon::new( Polygon::new(
LineString::from( LineString::from(
@ -95,7 +95,7 @@ impl<'a, R: AccessRules> MakePolygon for Poly<'a, R> {
} }
} }
impl<'a, R: AccessRules> GetMaybeApex for Poly<'a, R> { impl<R: AccessRules> GetMaybeApex for Poly<'_, R> {
fn maybe_apex(&self) -> Option<FixedDotIndex> { fn maybe_apex(&self) -> Option<FixedDotIndex> {
self.drawing self.drawing
.geometry() .geometry()

View File

@ -31,13 +31,13 @@ impl<'a, R> Via<'a, R> {
} }
} }
impl<'a, R: AccessRules> GetMaybeNet for Via<'a, R> { impl<R: AccessRules> GetMaybeNet for Via<'_, R> {
fn maybe_net(&self) -> Option<usize> { fn maybe_net(&self) -> Option<usize> {
self.drawing.compound_weight(self.index.into()).maybe_net() self.drawing.compound_weight(self.index.into()).maybe_net()
} }
} }
impl<'a, R: AccessRules> MakePrimitiveShape for Via<'a, R> { impl<R: AccessRules> MakePrimitiveShape for Via<'_, R> {
fn shape(&self) -> PrimitiveShape { fn shape(&self) -> PrimitiveShape {
if let CompoundWeight::Via(weight) = self.drawing.compound_weight(self.index.into()) { if let CompoundWeight::Via(weight) = self.drawing.compound_weight(self.index.into()) {
weight.shape() weight.shape()

View File

@ -74,7 +74,7 @@ impl RouteStepper {
} }
} }
impl<'a, R: AccessRules> Step<Router<'a, R>, BandTermsegIndex> for RouteStepper { impl<R: AccessRules> Step<Router<'_, R>, BandTermsegIndex> for RouteStepper {
type Error = AstarError; type Error = AstarError;
fn step( fn step(

View File

@ -66,7 +66,7 @@ impl<'a, R> RouterAstarStrategy<'a, R> {
} }
} }
impl<'a, R: AccessRules> RouterAstarStrategy<'a, R> { impl<R: AccessRules> RouterAstarStrategy<'_, R> {
fn bihead_length(&self) -> f64 { fn bihead_length(&self) -> f64 {
self.navcord.head.ref_(self.layout.drawing()).length() self.navcord.head.ref_(self.layout.drawing()).length()
+ match self.navcord.head.face() { + match self.navcord.head.face() {
@ -81,8 +81,8 @@ impl<'a, R: AccessRules> RouterAstarStrategy<'a, R> {
} }
} }
impl<'a, R: AccessRules> AstarStrategy<Navmesh, f64, BandTermsegIndex> impl<R: AccessRules> AstarStrategy<Navmesh, f64, BandTermsegIndex>
for RouterAstarStrategy<'a, R> for RouterAstarStrategy<'_, R>
{ {
fn is_goal( fn is_goal(
&mut self, &mut self,
@ -138,7 +138,7 @@ impl<'a, R: AccessRules> AstarStrategy<Navmesh, f64, BandTermsegIndex>
} }
fn remove_probe(&mut self, _navmesh: &Navmesh) { fn remove_probe(&mut self, _navmesh: &Navmesh) {
self.navcord.step_back(&mut self.layout); self.navcord.step_back(self.layout);
} }
fn estimate_cost(&mut self, navmesh: &Navmesh, vertex: NavvertexIndex) -> f64 { fn estimate_cost(&mut self, navmesh: &Navmesh, vertex: NavvertexIndex) -> f64 {

View File

@ -292,11 +292,10 @@ impl<
} }
impl< impl<
'a,
I: Copy + PartialEq + GetPetgraphIndex + std::fmt::Debug, I: Copy + PartialEq + GetPetgraphIndex + std::fmt::Debug,
VW: GetTrianvertexNodeIndex<I> + HasPosition, VW: GetTrianvertexNodeIndex<I> + HasPosition,
EW: Default, EW: Default,
> visit::NodeIndexable for &'a Triangulation<I, VW, EW> > visit::NodeIndexable for &Triangulation<I, VW, EW>
{ {
fn node_bound(&self) -> usize { fn node_bound(&self) -> usize {
//spade::Triangulation::num_vertices(&self.triangulation) //spade::Triangulation::num_vertices(&self.triangulation)