mirror of https://codeberg.org/topola/topola.git
chore: apply clippy fixes
This commit is contained in:
parent
8e3be44e18
commit
670ddbe1f7
|
|
@ -96,7 +96,7 @@ impl PinSelection {
|
|||
}
|
||||
|
||||
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> {
|
||||
|
|
@ -148,8 +148,7 @@ impl BandSelection {
|
|||
}
|
||||
|
||||
pub fn contains_node(&self, board: &Board<impl AccessMesadata>, node: NodeIndex) -> bool {
|
||||
BandSelector::try_from_node(board, node)
|
||||
.map_or(false, |selector| self.0.contains(&selector))
|
||||
BandSelector::try_from_node(board, node).is_some_and(|selector| self.0.contains(&selector))
|
||||
}
|
||||
|
||||
pub fn selectors(&self) -> impl Iterator<Item = &BandSelector> {
|
||||
|
|
@ -222,7 +221,7 @@ impl Selection {
|
|||
// 2. restrict to complete matches, return associated keys
|
||||
selectors
|
||||
.into_iter()
|
||||
.filter(|(_, nis)| &nis.0 == &nis.1)
|
||||
.filter(|(_, nis)| nis.0 == nis.1)
|
||||
.map(|(k, _)| k)
|
||||
.collect::<BTreeSet<_>>()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,12 +64,10 @@ impl<'a> ResolvedSelector<'a> {
|
|||
|
||||
if let Some(pin_name) = board.node_pinname(&node) {
|
||||
Some(ResolvedSelector::Pin { pin_name, layer })
|
||||
} else if let Some(loose) = loose {
|
||||
Some(ResolvedSelector::Band {
|
||||
} else {
|
||||
loose.map(|loose| ResolvedSelector::Band {
|
||||
band_uid: board.layout().drawing().loose_band_uid(loose),
|
||||
})
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
match self.first_seg {
|
||||
BandTermsegIndex::Straight(seg) => {
|
||||
|
|
|
|||
|
|
@ -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> {
|
||||
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> {
|
||||
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> {
|
||||
self.first_gear()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
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 {
|
||||
match self.head {
|
||||
Head::Bare(..) => 0.0,
|
||||
|
|
|
|||
|
|
@ -27,10 +27,10 @@ pub trait GetPrevNextLoose {
|
|||
// when `maybe_*` is `Some(_)`,
|
||||
// but otherwise, they start in opposite direction, here by going via:
|
||||
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)`
|
||||
// * `self.next_loose(default_neighbor)` on the other hand inverts the direction we're iterating towards.
|
||||
default_neighbor
|
||||
});
|
||||
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> {
|
||||
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> {
|
||||
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> {
|
||||
let joints = self.joints();
|
||||
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> {
|
||||
let joints = self.joints();
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ pub trait GetCore: GetBendIndex {
|
|||
fn core(&self) -> FixedDotIndex;
|
||||
}
|
||||
|
||||
impl<'a, S: GetDrawing + GetBendIndex> GetCore for S {
|
||||
impl<S: GetDrawing + GetBendIndex> GetCore for S {
|
||||
fn core(&self) -> FixedDotIndex {
|
||||
FixedDotIndex::new(
|
||||
self.drawing()
|
||||
|
|
@ -106,9 +106,7 @@ impl<'a, S: GetDrawing + GetBendIndex> GetCore for S {
|
|||
|
||||
macro_rules! impl_primitive {
|
||||
($primitive_struct:ident, $weight_struct:ident) => {
|
||||
impl<'a, CW: Copy, R: AccessRules> GetWeight<$weight_struct>
|
||||
for $primitive_struct<'a, CW, R>
|
||||
{
|
||||
impl<CW: Copy, R: AccessRules> GetWeight<$weight_struct> for $primitive_struct<'_, CW, R> {
|
||||
fn weight(&self) -> $weight_struct {
|
||||
if let PrimitiveWeight::$primitive_struct(weight) = self.tagged_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 {
|
||||
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> {
|
||||
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>
|
||||
for GenericPrimitive<'a, W, CW, R>
|
||||
{
|
||||
impl<W, CW: Copy, R: AccessRules> GetInterior<PrimitiveIndex> for GenericPrimitive<'_, W, CW, R> {
|
||||
fn interior(&self) -> Vec<PrimitiveIndex> {
|
||||
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;
|
||||
fn drawing(&self) -> &Drawing<impl Copy, R> {
|
||||
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> {
|
||||
self.index.petgraph_index()
|
||||
}
|
||||
|
|
@ -248,13 +244,13 @@ where
|
|||
pub type FixedDot<'a, CW, R> = GenericPrimitive<'a, FixedDotWeight, CW, R>;
|
||||
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 {
|
||||
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> {
|
||||
self.drawing
|
||||
.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>;
|
||||
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> {
|
||||
self.drawing
|
||||
.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 {
|
||||
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> {
|
||||
if let Some(seg) = self.seg() {
|
||||
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>;
|
||||
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 {
|
||||
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) {
|
||||
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>;
|
||||
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 {
|
||||
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>
|
||||
for LoneLooseSeg<'a, CW, R>
|
||||
{
|
||||
impl<CW: Copy, R: AccessRules> GetJoints<FixedDotIndex, FixedDotIndex> for LoneLooseSeg<'_, CW, R> {
|
||||
fn joints(&self) -> (FixedDotIndex, FixedDotIndex) {
|
||||
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>;
|
||||
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 {
|
||||
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) {
|
||||
let joints = self.drawing.geometry().seg_joints(self.index.into());
|
||||
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>;
|
||||
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 {
|
||||
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 {
|
||||
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>
|
||||
for FixedBend<'a, CW, R>
|
||||
{
|
||||
impl<CW: Copy, R: AccessRules> GetJoints<FixedDotIndex, FixedDotIndex> for FixedBend<'_, CW, R> {
|
||||
fn joints(&self) -> (FixedDotIndex, FixedDotIndex) {
|
||||
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> {}
|
||||
|
||||
pub type LooseBend<'a, CW, R> = GenericPrimitive<'a, LooseBendWeight, CW, R>;
|
||||
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 {
|
||||
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 {
|
||||
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 {
|
||||
self.weight().offset()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, CW: Copy, R: AccessRules> GetJoints<LooseDotIndex, LooseDotIndex>
|
||||
for LooseBend<'a, CW, R>
|
||||
{
|
||||
impl<CW: Copy, R: AccessRules> GetJoints<LooseDotIndex, LooseDotIndex> for LooseBend<'_, CW, R> {
|
||||
fn joints(&self) -> (LooseDotIndex, LooseDotIndex) {
|
||||
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> {
|
||||
self.drawing()
|
||||
.geometry()
|
||||
|
|
|
|||
|
|
@ -97,6 +97,12 @@ pub struct Geometry<PW, DW, SW, BW, CW, PI, DI, SI, 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> {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
|
|
|
|||
|
|
@ -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>)>,
|
||||
index: I,
|
||||
data: T,
|
||||
) where
|
||||
I: core::cmp::Eq + Ord,
|
||||
{
|
||||
) {
|
||||
let to_be_inserted = (Some(data), None);
|
||||
match map.entry(index) {
|
||||
BTreeMapEntry::Occupied(mut occ) => {
|
||||
|
|
|
|||
|
|
@ -41,10 +41,7 @@ impl<W> GenericIndex<W> {
|
|||
impl<W> core::clone::Clone for GenericIndex<W> {
|
||||
#[inline]
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
node_index: self.node_index,
|
||||
marker: PhantomData,
|
||||
}
|
||||
*self
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -67,9 +64,9 @@ impl<W> PartialEq for GenericIndex<W> {
|
|||
impl<W> Eq for GenericIndex<W> {}
|
||||
|
||||
impl<W> PartialOrd for GenericIndex<W> {
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||
self.node_index.partial_cmp(&other.node_index)
|
||||
Some(self.cmp(other))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ pub enum InteractionStepper {
|
|||
// - 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;
|
||||
|
||||
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>) {
|
||||
todo!();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -384,8 +384,8 @@ impl<R: AccessRules> Layout<R> {
|
|||
end: right_pos.into(),
|
||||
};
|
||||
let fake_seg = SegShape {
|
||||
from: left_pos.into(),
|
||||
to: right_pos.into(),
|
||||
from: left_pos,
|
||||
to: right_pos,
|
||||
width: f64::EPSILON * 16.0,
|
||||
};
|
||||
let mut orig_hline = NormalLine::from(ltr_line);
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
if let CompoundWeight::Poly(weight) = self.drawing.compound_weight(self.index.into()) {
|
||||
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> {
|
||||
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 {
|
||||
Polygon::new(
|
||||
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> {
|
||||
self.drawing
|
||||
.geometry()
|
||||
|
|
|
|||
|
|
@ -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> {
|
||||
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 {
|
||||
if let CompoundWeight::Via(weight) = self.drawing.compound_weight(self.index.into()) {
|
||||
weight.shape()
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
fn step(
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
self.navcord.head.ref_(self.layout.drawing()).length()
|
||||
+ match self.navcord.head.face() {
|
||||
|
|
@ -81,8 +81,8 @@ impl<'a, R: AccessRules> RouterAstarStrategy<'a, R> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, R: AccessRules> AstarStrategy<Navmesh, f64, BandTermsegIndex>
|
||||
for RouterAstarStrategy<'a, R>
|
||||
impl<R: AccessRules> AstarStrategy<Navmesh, f64, BandTermsegIndex>
|
||||
for RouterAstarStrategy<'_, R>
|
||||
{
|
||||
fn is_goal(
|
||||
&mut self,
|
||||
|
|
@ -138,7 +138,7 @@ impl<'a, R: AccessRules> AstarStrategy<Navmesh, f64, BandTermsegIndex>
|
|||
}
|
||||
|
||||
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 {
|
||||
|
|
|
|||
|
|
@ -292,11 +292,10 @@ impl<
|
|||
}
|
||||
|
||||
impl<
|
||||
'a,
|
||||
I: Copy + PartialEq + GetPetgraphIndex + std::fmt::Debug,
|
||||
VW: GetTrianvertexNodeIndex<I> + HasPosition,
|
||||
EW: Default,
|
||||
> visit::NodeIndexable for &'a Triangulation<I, VW, EW>
|
||||
> visit::NodeIndexable for &Triangulation<I, VW, EW>
|
||||
{
|
||||
fn node_bound(&self) -> usize {
|
||||
//spade::Triangulation::num_vertices(&self.triangulation)
|
||||
|
|
|
|||
Loading…
Reference in New Issue