diff options
Diffstat (limited to '2015/rs/code/nine/src')
-rw-r--r-- | 2015/rs/code/nine/src/main.rs | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/2015/rs/code/nine/src/main.rs b/2015/rs/code/nine/src/main.rs index 408b66a..1370354 100644 --- a/2015/rs/code/nine/src/main.rs +++ b/2015/rs/code/nine/src/main.rs @@ -2,7 +2,7 @@ use std::collections::HashMap; -static INPUT: &'static str = include_str!("input.txt"); +static INPUT: &str = include_str!("input.txt"); fn main() { let valueified = INPUT.split('\n').filter(|s| !s.is_empty()) @@ -39,14 +39,13 @@ fn walk_steps(path: &mut Vec<&'static str>, dist: usize, bestpath: &mut Vec<&'st walk_steps(path, dist + stepdist, bestpath, bestdist, worstpath, worstdist, steps); path.pop(); } - } else { - if dist < *bestdist { - *bestpath = path.clone(); - *bestdist = dist; - } - else if dist > *worstdist { - *worstpath = path.clone(); - *worstdist = dist; - } + } + + else if dist < *bestdist { + *bestpath = path.clone(); + *bestdist = dist; + } else if dist > *worstdist { + *worstpath = path.clone(); + *worstdist = dist; } } |