Remove unused dependencies
This commit is contained in:
parent
0a2c8f28a6
commit
9a941e9d00
|
@ -7,5 +7,3 @@ edition = "2018"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
itertools = "0.9.0"
|
|
||||||
text_io = "0.1.8"
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#![feature(test)]
|
#![feature(test)]
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
extern crate test;
|
extern crate test;
|
||||||
use itertools::Itertools;
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let input = parse_input(&read_input());
|
let input = parse_input(&read_input());
|
||||||
|
@ -49,7 +48,7 @@ fn read_input() -> String {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn part1<'a>(bags: &[Bag], color: &str, seen: &'a mut HashSet<String>) -> &'a mut HashSet<String> {
|
fn part1<'a>(bags: &[Bag], color: &str, seen: &'a mut HashSet<String>) -> &'a mut HashSet<String> {
|
||||||
for bag in bags.iter().filter(|bag| bag.contents.iter().find(|b| b.color == color).is_some()) {
|
for bag in bags.iter().filter(|bag| bag.contents.iter().any(|b| b.color == color)) {
|
||||||
seen.insert(bag.color.clone());
|
seen.insert(bag.color.clone());
|
||||||
part1(bags, &bag.color, seen);
|
part1(bags, &bag.color, seen);
|
||||||
}
|
}
|
||||||
|
@ -69,7 +68,7 @@ fn parse_input(s: &str) -> Vec<Bag> {
|
||||||
.replace(" bag", "")
|
.replace(" bag", "")
|
||||||
.replace('.', "")
|
.replace('.', "")
|
||||||
.lines()
|
.lines()
|
||||||
.map_into()
|
.map(Bag::from)
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user