Remove unused dependencies

This commit is contained in:
kageru 2020-12-07 12:09:30 +01:00
parent 0a2c8f28a6
commit 9a941e9d00
Signed by: kageru
GPG Key ID: 8282A2BEA4ADA3D2
2 changed files with 2 additions and 5 deletions

View File

@ -7,5 +7,3 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
itertools = "0.9.0"
text_io = "0.1.8"

View File

@ -1,7 +1,6 @@
#![feature(test)]
use std::collections::HashSet;
extern crate test;
use itertools::Itertools;
fn main() {
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> {
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());
part1(bags, &bag.color, seen);
}
@ -69,7 +68,7 @@ fn parse_input(s: &str) -> Vec<Bag> {
.replace(" bag", "")
.replace('.', "")
.lines()
.map_into()
.map(Bag::from)
.collect()
}