Skip to content

Commit

Permalink
refactor: Simplify PortGraph::port_links (#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
acl-cqc authored Feb 24, 2025
1 parent b0c0cfc commit 93a3a05
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/portgraph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -712,14 +712,9 @@ impl LinkView for PortGraph {

fn port_links(&self, port: PortIndex) -> impl Iterator<Item = (PortIndex, PortIndex)> + Clone {
self.port_meta_valid(port).unwrap();
match self.port_link[port.index()] {
Some(link) => std::iter::once((port, link)),
None => {
let mut iter = std::iter::once((port, port));
iter.next();
iter
}
}
self.port_link[port.index()]
.map(|link| (port, link))
.into_iter()
}

#[inline]
Expand Down

0 comments on commit 93a3a05

Please sign in to comment.