diff --git a/src/main.rs b/src/main.rs index c816dac..0a2426c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -39,14 +39,17 @@ mod rover { } pub fn rotate((lon, lat, direction) : &Rover, rotation: Rotation) -> Rover { - if rotation == Rotation::Left { - let new_d = next_direction(*direction); - (*lon, *lat, new_d) - } else { - let new_d = next_direction(*direction); - let new_d = next_direction(new_d); - let new_d = next_direction(new_d); - (*lon, *lat, new_d) + match rotation { + Rotation::Left => { + let new_d = next_direction(*direction); + (*lon, *lat, new_d) + }, + Rotation::Right => { + let new_d = next_direction(*direction); + let new_d = next_direction(new_d); + let new_d = next_direction(new_d); + (*lon, *lat, new_d) + } } } }