Fix find_unconnected_ports

This commit is contained in:
Weird Constructor 2022-07-24 19:12:43 +02:00
parent a336ae9420
commit 5ec75c3062

View file

@ -385,11 +385,7 @@ impl Cell {
/// Finds all dangling ports in the specified direction. /// Finds all dangling ports in the specified direction.
/// With `dir` you can specify input with `CellDir::T`, output with `CellDir::B` /// With `dir` you can specify input with `CellDir::T`, output with `CellDir::B`
/// and any with `CellDir::C`. /// and any with `CellDir::C`.
pub fn find_unconnected_ports( pub fn find_unconnected_ports(&self, m: &Matrix, dir: CellDir) -> Vec<CellDir> {
&self,
m: &Matrix,
dir: CellDir,
) -> Vec<(CellDir, (usize, usize))> {
let mut unused_ports = vec![]; let mut unused_ports = vec![];
let options: &[CellDir] = if dir == CellDir::C { let options: &[CellDir] = if dir == CellDir::C {
@ -402,9 +398,7 @@ impl Cell {
for dir in options { for dir in options {
if self.is_port_dir_connected(m, *dir).is_none() { if self.is_port_dir_connected(m, *dir).is_none() {
if let Some(pos) = dir.offs_pos((self.x as usize, self.y as usize)) { unused_ports.push(*dir);
unused_ports.push((*dir, pos));
}
} }
} }