Replace drain with split_at
continuous-integration/drone/push Build is passing Details

pull/1/head
Julius 2021-12-04 10:45:54 +01:00
parent 0074ccaf0f
commit e1130b20f3
Signed by: j00lz
GPG Key ID: AF241B0AA237BBA2
1 changed files with 4 additions and 5 deletions

View File

@ -11,13 +11,12 @@ struct Board(Vec<Vec<Option<u32>>>);
impl Day for Day04 {
fn init(content: String) -> Self where Self: Sized {
let mut l = content.lines().collect::<Vec<&str>>();
let first = l[0];
let a = l.drain(0..2);
drop(a);
let l = content.lines().collect::<Vec<&str>>();
let (a, b) = l.split_at(2);
let first = a[0];
let nums = first.split(',').map(|x| x.parse::<u32>().expect("wat?")).collect();
let split = l.split(|x| x.is_empty());
let split = b.split(|x| x.is_empty());
let boards = split.map(|vecs|
vecs.iter().map(