From 08fd126255c229cb13db81d92e64d14cf1b9e524 Mon Sep 17 00:00:00 2001 From: Michael Peters Date: Tue, 12 Mar 2024 16:11:50 -0700 Subject: [PATCH] formatting --- src/main.rs | 54 ++++++++++++++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/src/main.rs b/src/main.rs index 163ea42..7daffdd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -38,7 +38,6 @@ struct Face { br: Color, } -#[allow(dead_code)] impl Face { fn new(c: Color) -> Self { Self { @@ -167,32 +166,6 @@ fn parse_moves(moves_str: &str) -> Result, &'static str> { Ok(moves) } -#[rustfmt::skip] -fn apply_moves(c: &mut Cube, moves: Vec) { - for m in moves { - match m { - Move::U => { c.u(); }, - Move::U2 => { c.u(); c.u(); }, - Move::Up => { c.u(); c.u(); c.u(); }, - Move::D => { c.d(); }, - Move::D2 => { c.d(); c.d(); }, - Move::Dp => { c.d(); c.d(); c.d(); }, - Move::L => { c.l(); }, - Move::L2 => { c.l(); c.l(); }, - Move::Lp => { c.l(); c.l(); c.l(); }, - Move::R => { c.r(); }, - Move::R2 => { c.r(); c.r(); } - Move::Rp => { c.r(); c.r(); c.r(); } - Move::F => { c.f(); }, - Move::F2 => { c.f(); c.f(); } - Move::Fp => { c.f(); c.f(); c.f(); } - Move::B => { c.b(); }, - Move::B2 => { c.b(); c.b(); } - Move::Bp => { c.b(); c.b(); c.b(); } - } - } -} - struct Cube { u: Face, d: Face, @@ -220,7 +193,6 @@ impl fmt::Display for Cube { } } -#[allow(dead_code)] impl Cube { fn new() -> Self { Self { @@ -293,6 +265,32 @@ impl Cube { // TODO: efficient double / counter-clockwise } +#[rustfmt::skip] +fn apply_moves(c: &mut Cube, moves: Vec) { + for m in moves { + match m { + Move::U => { c.u(); }, + Move::U2 => { c.u(); c.u(); }, + Move::Up => { c.u(); c.u(); c.u(); }, + Move::D => { c.d(); }, + Move::D2 => { c.d(); c.d(); }, + Move::Dp => { c.d(); c.d(); c.d(); }, + Move::L => { c.l(); }, + Move::L2 => { c.l(); c.l(); }, + Move::Lp => { c.l(); c.l(); c.l(); }, + Move::R => { c.r(); }, + Move::R2 => { c.r(); c.r(); } + Move::Rp => { c.r(); c.r(); c.r(); } + Move::F => { c.f(); }, + Move::F2 => { c.f(); c.f(); } + Move::Fp => { c.f(); c.f(); c.f(); } + Move::B => { c.b(); }, + Move::B2 => { c.b(); c.b(); } + Move::Bp => { c.b(); c.b(); c.b(); } + } + } +} + fn main() { let mut c = Cube::new(); println!("Here's the cube:\n{}", c);