Use lines instead of split('\n')
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
797c33b090
commit
666675342d
|
@ -3,7 +3,7 @@ pub struct Day01(Vec<i32>);
|
|||
|
||||
impl crate::day::Day for Day01 {
|
||||
fn init(f: String) -> Self {
|
||||
let v = f.split('\n').map(|x| x.parse::<i32>().unwrap()).collect::<Vec<i32>>();
|
||||
let v = f.lines().map(|x| x.parse::<i32>().unwrap()).collect::<Vec<i32>>();
|
||||
Self(v)
|
||||
}
|
||||
|
||||
|
|
|
@ -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::<Vec<Instruction>>();
|
||||
let lines = content.lines().map(str_to_instr).collect::<Vec<Instruction>>();
|
||||
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);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue