1
0
Fork 0

remove debug derives

main
Andrew Coleman 2023-12-13 13:48:00 -05:00
parent e6cf50fb47
commit fc5670b37e
6 changed files with 11 additions and 23 deletions

View File

@ -4,14 +4,12 @@ const MAX_RED: u32 = 12;
const MAX_GREEN: u32 = 13; const MAX_GREEN: u32 = 13;
const MAX_BLUE: u32 = 14; const MAX_BLUE: u32 = 14;
#[derive(Debug)]
struct Turn { struct Turn {
red: u32, red: u32,
green: u32, green: u32,
blue: u32, blue: u32,
} }
#[derive(Debug)]
struct Game { struct Game {
id: u32, id: u32,
turns: Vec<Turn>, turns: Vec<Turn>,

View File

@ -1,7 +1,6 @@
use aoc_runner_derive::{aoc, aoc_generator}; use aoc_runner_derive::{aoc, aoc_generator};
use std::collections::HashSet; use std::collections::HashSet;
#[derive(Debug)]
struct Card { struct Card {
id: usize, id: usize,
winning: HashSet<u32>, winning: HashSet<u32>,

View File

@ -1,6 +1,5 @@
use aoc_runner_derive::{aoc, aoc_generator}; use aoc_runner_derive::{aoc, aoc_generator};
#[derive(Debug)]
struct Race { struct Race {
time: u64, time: u64,
distance: u64, distance: u64,

View File

@ -3,7 +3,7 @@ use std::cmp::Ordering;
use std::collections::{BTreeMap, HashSet}; use std::collections::{BTreeMap, HashSet};
use std::str::FromStr; use std::str::FromStr;
#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, Debug)] #[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
enum Card { enum Card {
A, A,
K, K,
@ -20,7 +20,7 @@ enum Card {
C2, C2,
} }
#[derive(Copy, Clone, PartialEq, PartialOrd, Eq, Ord, Hash, Debug)] #[derive(Copy, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
enum Part2Card { enum Part2Card {
A, A,
K, K,
@ -77,7 +77,7 @@ impl FromStr for Card {
} }
} }
#[derive(Debug, Clone, Eq, Ord, PartialEq, PartialOrd)] #[derive(Clone, Eq, Ord, PartialEq, PartialOrd)]
enum HandKinds { enum HandKinds {
FiveAlike, FiveAlike,
FourAlike, FourAlike,
@ -88,7 +88,7 @@ enum HandKinds {
HighCard, HighCard,
} }
#[derive(Debug, Clone)] #[derive(Clone)]
struct Hand { struct Hand {
bid: u64, bid: u64,
cards: [Card; 5], cards: [Card; 5],
@ -123,10 +123,7 @@ impl Ord for Hand {
} else if self.cards[4] != other.cards[4] { } else if self.cards[4] != other.cards[4] {
self.cards[4].cmp(&other.cards[4]) self.cards[4].cmp(&other.cards[4])
} else { } else {
panic!( panic!("could not sort hand")
"could not sort hand {:?} with {:?}",
self.cards, other.cards
)
} }
} else { } else {
self.hand_kind.cmp(&other.hand_kind) self.hand_kind.cmp(&other.hand_kind)
@ -162,10 +159,7 @@ impl Ord for Part2Hand {
} else if self.cards[4] != other.cards[4] { } else if self.cards[4] != other.cards[4] {
self.cards[4].cmp(&other.cards[4]) self.cards[4].cmp(&other.cards[4])
} else { } else {
panic!( panic!("could not sort hand")
"could not sort hand {:?} with {:?}",
self.cards, other.cards
)
} }
} else { } else {
self.hand_kind.cmp(&other.hand_kind) self.hand_kind.cmp(&other.hand_kind)
@ -175,7 +169,7 @@ impl Ord for Part2Hand {
fn get_hand_type<T>(cards: &[T; 5]) -> HandKinds fn get_hand_type<T>(cards: &[T; 5]) -> HandKinds
where where
T: std::fmt::Debug + Eq + PartialEq + PartialOrd + std::hash::Hash, T: Eq + PartialEq + PartialOrd + std::hash::Hash,
{ {
let mut distinct_cards: HashSet<&T> = HashSet::new(); let mut distinct_cards: HashSet<&T> = HashSet::new();
for c in cards.iter() { for c in cards.iter() {
@ -212,14 +206,12 @@ where
4 => HandKinds::OnePair, 4 => HandKinds::OnePair,
5 => HandKinds::HighCard, 5 => HandKinds::HighCard,
_ => panic!( _ => panic!(
"expected to find size 1-5, but instead got {} from line {:?}", "expected to find size 1-5, but instead got {}",
distinct_cards.len(), distinct_cards.len()
cards
), ),
} }
} }
#[derive(Debug)]
struct Part2Hand { struct Part2Hand {
bid: u64, bid: u64,
cards: [Part2Card; 5], cards: [Part2Card; 5],

View File

@ -11,7 +11,7 @@ struct MetalIsland {
start: Step, start: Step,
} }
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Clone, Copy, PartialEq, Eq)]
enum Pieces { enum Pieces {
Empty, Empty,
Start, Start,

View File

@ -27,7 +27,7 @@ impl Galaxy {
} }
} }
#[derive(Debug, Eq, PartialEq, Copy, Clone)] #[derive(Eq, PartialEq, Copy, Clone)]
struct Coord(usize, usize); struct Coord(usize, usize);
impl Coord { impl Coord {