diff --git a/src/day01.rs b/src/day01.rs index 00ffc9a..af497b9 100644 --- a/src/day01.rs +++ b/src/day01.rs @@ -3,7 +3,7 @@ pub struct Day01(Vec); impl crate::day::Day for Day01 { fn init(f: String) -> Self { - let v = f.split('\n').map(|x| x.parse::().unwrap()).collect::>(); + let v = f.lines().map(|x| x.parse::().unwrap()).collect::>(); Self(v) } diff --git a/src/day02.rs b/src/day02.rs index c1a5c66..4c656d0 100644 --- a/src/day02.rs +++ b/src/day02.rs @@ -10,7 +10,7 @@ enum Instruction { impl Day for Day02 { fn init(content: String) -> Self { - let lines = content.split("\n").map(str_to_instr).collect::>(); + let lines = content.lines().map(str_to_instr).collect::>(); Day02(lines) } @@ -100,6 +100,6 @@ forward 2"; #[should_panic] fn very_invalid_input(){ let f = String::from("invalid 10"); - let d = Day02::init(f); + Day02::init(f); } } \ No newline at end of file