remove unnecessary &mut

This commit is contained in:
Weird Constructor 2022-07-23 16:56:59 +02:00
parent 879bb46cc2
commit 1a4be5421d

View file

@ -275,13 +275,13 @@ impl Cell {
self self
} }
/// Finds the first free input (one without an adjacent cell). If any free input /// Finds the first free input or output (one without an adjacent cell). If any free input/output
/// has an assigned input, that edge is returned. /// has an assigned input, that edge is returned.
/// 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_first_adjacent_free( pub fn find_first_adjacent_free(
&self, &self,
m: &mut Matrix, m: &Matrix,
dir: CellDir, dir: CellDir,
) -> Option<(CellDir, Option<u8>)> { ) -> Option<(CellDir, Option<u8>)> {
let mut free_ports = vec![]; let mut free_ports = vec![];
@ -320,7 +320,7 @@ impl Cell {
/// and any with `CellDir::C`. /// and any with `CellDir::C`.
pub fn find_all_adjacent_free( pub fn find_all_adjacent_free(
&self, &self,
m: &mut Matrix, m: &Matrix,
dir: CellDir, dir: CellDir,
) -> Vec<(CellDir, (usize, usize))> { ) -> Vec<(CellDir, (usize, usize))> {
let mut free_ports = vec![]; let mut free_ports = vec![];
@ -345,7 +345,7 @@ impl Cell {
} }
/// If the port is connected, it will return the position of the other cell. /// If the port is connected, it will return the position of the other cell.
pub fn is_port_dir_connected(&self, m: &mut Matrix, dir: CellDir) -> Option<(usize, usize)> { pub fn is_port_dir_connected(&self, m: &Matrix, dir: CellDir) -> Option<(usize, usize)> {
if self.has_dir_set(dir) { if self.has_dir_set(dir) {
if let Some(new_pos) = dir.offs_pos((self.x as usize, self.y as usize)) { if let Some(new_pos) = dir.offs_pos((self.x as usize, self.y as usize)) {
if let Some(dst_cell) = m.get(new_pos.0, new_pos.1) { if let Some(dst_cell) = m.get(new_pos.0, new_pos.1) {