From 08246225fb7dc230959da4c8ca38ca0743a9ca3a Mon Sep 17 00:00:00 2001 From: Matej Focko Date: Fri, 6 Jan 2023 20:00:52 +0100 Subject: [PATCH] refactor: publicly use common types/macros in solution Signed-off-by: Matej Focko --- src/bin/day02.rs | 3 --- src/bin/day03.rs | 2 -- src/bin/day04.rs | 2 -- src/bin/day05.rs | 3 --- src/bin/day06.rs | 2 -- src/bin/day07.rs | 3 --- src/bin/day08.rs | 2 -- src/bin/day09.rs | 3 --- src/bin/day10.rs | 4 ---- src/bin/day11.rs | 6 ------ src/bin/day12.rs | 2 -- src/bin/day13.rs | 4 ---- src/bin/day14.rs | 4 ---- src/bin/day15.rs | 5 ----- src/solution.rs | 7 +++++-- 15 files changed, 5 insertions(+), 47 deletions(-) diff --git a/src/bin/day02.rs b/src/bin/day02.rs index c05a084..7d4aef9 100644 --- a/src/bin/day02.rs +++ b/src/bin/day02.rs @@ -2,9 +2,6 @@ use std::str::FromStr; use aoc_2022::*; -use color_eyre::{eyre::eyre, Report}; -use itertools::Itertools; - type Input = Vec; type Output = i32; diff --git a/src/bin/day03.rs b/src/bin/day03.rs index ce86366..87c603f 100644 --- a/src/bin/day03.rs +++ b/src/bin/day03.rs @@ -3,8 +3,6 @@ use std::str::FromStr; use aoc_2022::*; -use color_eyre::eyre::Report; - type Input = Vec; type Output = i32; diff --git a/src/bin/day04.rs b/src/bin/day04.rs index 81d3674..b096b7a 100644 --- a/src/bin/day04.rs +++ b/src/bin/day04.rs @@ -3,8 +3,6 @@ use std::str::FromStr; use aoc_2022::*; -use color_eyre::eyre::Report; - type Input = Vec; type Output = usize; diff --git a/src/bin/day05.rs b/src/bin/day05.rs index 45cc685..0b3cdbb 100644 --- a/src/bin/day05.rs +++ b/src/bin/day05.rs @@ -3,9 +3,6 @@ use std::str::FromStr; use aoc_2022::*; -use color_eyre::eyre::Report; -use itertools::Itertools; - type Input = Ship; type Output = String; diff --git a/src/bin/day06.rs b/src/bin/day06.rs index e9ae1f2..ad1da55 100644 --- a/src/bin/day06.rs +++ b/src/bin/day06.rs @@ -2,8 +2,6 @@ use std::collections::HashSet; use aoc_2022::*; -use itertools::Itertools; - type Input = String; type Output = usize; diff --git a/src/bin/day07.rs b/src/bin/day07.rs index 274491c..6a4eae2 100644 --- a/src/bin/day07.rs +++ b/src/bin/day07.rs @@ -2,9 +2,6 @@ use std::{cell::RefCell, cmp::min, collections::BTreeMap, rc::Rc, str::FromStr}; use aoc_2022::*; -use color_eyre::Report; -use itertools::Itertools; - type Input = Filesystem; type Output = usize; diff --git a/src/bin/day08.rs b/src/bin/day08.rs index da280d6..f69cb05 100644 --- a/src/bin/day08.rs +++ b/src/bin/day08.rs @@ -2,8 +2,6 @@ use std::{cmp::max, collections::BTreeSet}; use aoc_2022::*; -use itertools::Itertools; - type Input = Vec>; type Output = usize; diff --git a/src/bin/day09.rs b/src/bin/day09.rs index cfea22b..543cc88 100644 --- a/src/bin/day09.rs +++ b/src/bin/day09.rs @@ -2,9 +2,6 @@ use std::{collections::BTreeSet, str::FromStr}; use aoc_2022::*; -use color_eyre::{eyre::eyre, Report}; -use itertools::Itertools; - type Input = Vec; type Output = usize; diff --git a/src/bin/day10.rs b/src/bin/day10.rs index 688cee5..1771763 100644 --- a/src/bin/day10.rs +++ b/src/bin/day10.rs @@ -2,10 +2,6 @@ use std::{collections::HashMap, fmt::Display, str::FromStr}; use aoc_2022::*; -use color_eyre::{eyre::eyre, Report}; -use itertools::Itertools; -use lazy_static::lazy_static; - type Input = Vec; type Output = Out; diff --git a/src/bin/day11.rs b/src/bin/day11.rs index c96a72c..eee2e41 100644 --- a/src/bin/day11.rs +++ b/src/bin/day11.rs @@ -2,12 +2,6 @@ use std::{cmp::Reverse, collections::VecDeque, mem, str::FromStr}; use aoc_2022::*; -use color_eyre::{eyre::eyre, Report}; -use itertools::Itertools; -use lazy_static::lazy_static; -use regex::Regex; -use tracing::debug; - type Input = Vec; type Output = usize; diff --git a/src/bin/day12.rs b/src/bin/day12.rs index 868221f..b31c636 100644 --- a/src/bin/day12.rs +++ b/src/bin/day12.rs @@ -2,8 +2,6 @@ use std::collections::{BTreeSet, VecDeque}; use aoc_2022::*; -use itertools::Itertools; - type Input = Vec>; type Output = usize; diff --git a/src/bin/day13.rs b/src/bin/day13.rs index c2dc234..67aec79 100644 --- a/src/bin/day13.rs +++ b/src/bin/day13.rs @@ -2,10 +2,6 @@ use std::{cmp::Ordering, fmt::Display, str::FromStr}; use aoc_2022::*; -use color_eyre::Report; -use itertools::Itertools; -// use tracing::debug; - type Input = Vec; type Output = usize; diff --git a/src/bin/day14.rs b/src/bin/day14.rs index ae94cab..c03c5f7 100644 --- a/src/bin/day14.rs +++ b/src/bin/day14.rs @@ -6,10 +6,6 @@ use std::{ use aoc_2022::*; -use color_eyre::Report; -use itertools::Itertools; -// use tracing::debug; - type Input = Vec; type Output = usize; diff --git a/src/bin/day15.rs b/src/bin/day15.rs index aae30fb..138ee06 100644 --- a/src/bin/day15.rs +++ b/src/bin/day15.rs @@ -6,12 +6,7 @@ use std::{ use aoc_2022::*; -use color_eyre::Report; -use itertools::Itertools; -use lazy_static::lazy_static; use rayon::prelude::{IntoParallelIterator, ParallelIterator}; -use regex::Regex; -// use tracing::debug; type Input = Vec; type Output = usize; diff --git a/src/solution.rs b/src/solution.rs index bae0c7c..9e0ce2c 100644 --- a/src/solution.rs +++ b/src/solution.rs @@ -2,8 +2,11 @@ use std::any::type_name; use std::fmt::Display; pub use std::path::Path; -pub use color_eyre::eyre::Result; -use tracing::info; +pub use color_eyre::eyre::{eyre, Report, Result}; +pub use itertools::Itertools; +pub use lazy_static::lazy_static; +pub use regex::Regex; +pub use tracing::{debug, error, info, trace, warn}; use tracing_subscriber::EnvFilter; pub trait Solution {