squash-me: Remove debugs

This commit is contained in:
Kerollmops 2020-06-10 16:28:33 +02:00
parent 3ad883d7c7
commit 78f27c0465
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4

View File

@ -50,9 +50,9 @@ impl Path {
// We retrieve the tail of the current path and try to find // We retrieve the tail of the current path and try to find
// the successor of this tail. // the successor of this tail.
let next_path_tail = dbg!(self.0.last().unwrap() + 1); let next_path_tail = self.0.last().unwrap() + 1;
// To do so we add 1 to the tail and check that something exists. // To do so we add 1 to the tail and check that something exists.
let path_tail_index = dbg!(positions[self.0.len() - 1].binary_search(&next_path_tail).unwrap_or_else(|p| p)); let path_tail_index = positions[self.0.len() - 1].binary_search(&next_path_tail).unwrap_or_else(|p| p);
// If we found something it means that we can shift the path. // If we found something it means that we can shift the path.
if let Some(pos) = positions[self.0.len() - 1].get(path_tail_index) { if let Some(pos) = positions[self.0.len() - 1].get(path_tail_index) {
let mut shifted_path = self.0.clone(); let mut shifted_path = self.0.clone();
@ -62,9 +62,6 @@ impl Path {
successors.push((path, proximity)); successors.push((path, proximity));
} }
eprintln!("self: {:?}", self);
successors.iter().for_each(|s| eprintln!("successor: {:?}", s));
successors successors
} }
@ -102,16 +99,16 @@ impl Iterator for BestProximity {
let result = dijkstra( let result = dijkstra(
&Path::new(&self.positions)?, &Path::new(&self.positions)?,
|p| p.successors(&self.positions), |p| p.successors(&self.positions),
|p| self.is_path_successful(p) && output.as_ref().map_or(true, |paths| !paths.1.contains(&p.0)), |p| self.is_path_successful(p) && output.as_ref().map_or(true, |(_, paths)| !paths.contains(&p.0)),
); );
match dbg!(result) { match result {
Some((mut paths, _)) => { Some((mut paths, _)) => {
let positions = paths.pop().unwrap(); let positions = paths.pop().unwrap();
let proximity = positions.proximity(); let proximity = positions.proximity();
// If the current output is // If the current output is
match dbg!(&mut output) { match &mut output {
Some((best_proximity, paths)) => { Some((best_proximity, paths)) => {
// If the shortest path we found is bigger than the one requested // If the shortest path we found is bigger than the one requested
// it means that we found all the paths with the same proximity and can // it means that we found all the paths with the same proximity and can