diff --git a/src/main.rs b/src/main.rs index c11d41e..0c6e249 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,11 +31,7 @@ fn check_map(r: &robot::Robot, w: &world::World) -> Result<(), String> { } /// Check if the robot collide with another one at the given position. -fn check_collisions( - r: &robot::Robot, - w: &world::World, - h: &HashMap<&robot::Position, &u32>, -) -> Result<(), String> { +fn check_collisions(r: &robot::Robot, h: &HashMap) -> Result<(), String> { match h.get(&r.p) { Some(&x) => Err(format!( "The robot id: {} collided with robot id: {} in position: ({};{}) !", @@ -262,10 +258,9 @@ mod tests { robot::Position { x: 2, y: 3 }, vec!['F'], ); - let w = world::World { x: 10, y: 10 }; - let mut h: HashMap<&robot::Position, &u32> = HashMap::new(); - h.insert(&robot::Position { x: 2, y: 3 }, &1); - assert!(check_collisions(&r, &w, &h).is_ok()); + let mut h: HashMap = HashMap::new(); + h.insert(robot::Position { x: 2, y: 3 }, 1); + assert!(check_collisions(&r, &h).is_ok()); } }