From bb8f1c5da30ff9b4a6fed9941af85d0c37f5ba60 Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Sat, 16 Dec 2017 17:31:38 -0800 Subject: [PATCH] [2017][rust][6.x] rustfmt --- 2017/rust/src/day_06.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/2017/rust/src/day_06.rs b/2017/rust/src/day_06.rs index e1ddb9d..1464cc6 100644 --- a/2017/rust/src/day_06.rs +++ b/2017/rust/src/day_06.rs @@ -1,20 +1,24 @@ use std::collections::HashSet; use failure::*; +#[allow(dead_code)] pub fn solve(input: &str) -> Result { let banks: Vec<_> = input .split_whitespace() .map(str::parse) .collect::>()?; - let mut reallocation = Reallocation { banks: banks.clone() }; + let mut reallocation = Reallocation { + banks: banks.clone(), + }; let cycles = unique_cycles(reallocation); reallocation = Reallocation { banks }; Ok((unique_cycles(reallocation.skip(cycles - 1)) - 1).to_string()) } -fn unique_cycles>>(reallocation: R) -> usize { +#[allow(dead_code)] +fn unique_cycles>>(reallocation: R) -> usize { let mut seen = HashSet::new(); for (i, banks) in reallocation.enumerate() { if seen.contains(&banks) { @@ -28,10 +32,13 @@ fn unique_cycles>>(reallocation: R) -> usize { #[test] fn test_part_one() { - let reallocation = Reallocation { banks: vec![0, 2, 7, 0] }; + let reallocation = Reallocation { + banks: vec![0, 2, 7, 0], + }; assert_eq!(unique_cycles(reallocation), 5); } +#[allow(dead_code)] struct Reallocation { banks: Vec, }