Replace drain with split_at
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
0074ccaf0f
commit
e1130b20f3
|
@ -11,13 +11,12 @@ struct Board(Vec<Vec<Option<u32>>>);
|
||||||
|
|
||||||
impl Day for Day04 {
|
impl Day for Day04 {
|
||||||
fn init(content: String) -> Self where Self: Sized {
|
fn init(content: String) -> Self where Self: Sized {
|
||||||
let mut l = content.lines().collect::<Vec<&str>>();
|
let l = content.lines().collect::<Vec<&str>>();
|
||||||
let first = l[0];
|
let (a, b) = l.split_at(2);
|
||||||
let a = l.drain(0..2);
|
let first = a[0];
|
||||||
drop(a);
|
|
||||||
let nums = first.split(',').map(|x| x.parse::<u32>().expect("wat?")).collect();
|
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|
|
let boards = split.map(|vecs|
|
||||||
vecs.iter().map(
|
vecs.iter().map(
|
||||||
|
|
Loading…
Reference in a new issue