I am using code_to_id lmao
parent
e922599372
commit
ba5642063e
|
@ -10,15 +10,15 @@ airport-paths -h
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn handle_args(args: Vec<String>, _code_to_id: HashMap<String, usize>) -> (usize, usize) {
|
pub fn handle_args(args: Vec<String>, code_to_id: HashMap<String, usize>) -> (usize, usize) {
|
||||||
let (origin, destination) = match args.len() {
|
let (origin, destination) = match args.len() {
|
||||||
3 => {
|
3 => {
|
||||||
let exit_handler = || {
|
let exit_handler = || {
|
||||||
println!("unable to find airport");
|
println!("unable to find airport");
|
||||||
exit(2);
|
exit(2);
|
||||||
};
|
};
|
||||||
let origin = _code_to_id.get(&args[1]).unwrap_or_else(exit_handler);
|
let origin = code_to_id.get(&args[1]).unwrap_or_else(exit_handler);
|
||||||
let destination = _code_to_id.get(&args[2]).unwrap_or_else(exit_handler);
|
let destination = code_to_id.get(&args[2]).unwrap_or_else(exit_handler);
|
||||||
|
|
||||||
(origin, destination)
|
(origin, destination)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue