improve names

This commit is contained in:
Daniel Barlow 2023-11-02 23:21:40 +00:00
parent e4bd2597d5
commit 023923f06b

View File

@ -58,7 +58,7 @@ mod rover {
mod driver {
use super::rover;
fn perform_insn(command: &str, rover: &rover::Rover) -> rover::Rover {
fn perform_command(command: &str, rover: &rover::Rover) -> rover::Rover {
match command {
"f" => rover::forward(&rover),
"b" => rover::backward(&rover),
@ -68,12 +68,12 @@ mod driver {
}
}
pub fn execute(rover: &rover::Rover, instructions: &str) -> rover::Rover {
if instructions.is_empty() {
pub fn execute(rover: &rover::Rover, commands: &str) -> rover::Rover {
if commands.is_empty() {
rover.clone()
} else {
let (first, rest) = instructions.split_at(1);
execute(&perform_insn(first, rover), rest)
let (now, later) = commands.split_at(1);
execute(&perform_command(now, rover), later)
}
}
}