From 76453dedf60de80d50c90bcffe055c2c07df3cd8 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Thu, 21 Mar 2024 11:23:44 +0100 Subject: [PATCH] moar attributes --- src/bin/game/cli.rs | 16 +++++++++++----- src/bin/game/tui.rs | 6 ++++++ src/game/mod.rs | 10 ++-------- src/lib.rs | 6 ++++++ 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/bin/game/cli.rs b/src/bin/game/cli.rs index 9bbd785..0d10e78 100644 --- a/src/bin/game/cli.rs +++ b/src/bin/game/cli.rs @@ -1,6 +1,9 @@ +#![warn(clippy::all)] +#![warn(missing_docs)] +#![warn(missing_debug_implementations)] use clap::Parser; use libpt::log::*; -use wordle_analyzer::{game,self}; +use wordle_analyzer::{self, game}; #[derive(Parser, Clone, Debug)] #[command(version, about, long_about, author)] @@ -13,7 +16,7 @@ struct Cli { length: usize, /// how many times can we guess? #[arg(short, long, default_value_t = wordle_analyzer::DEFAULT_MAX_STEPS)] - max_steps: usize + max_steps: usize, } fn main() -> anyhow::Result<()> { @@ -23,7 +26,8 @@ fn main() -> anyhow::Result<()> { let game = game::Game::builder() .length(cli.length) - .precompute(cli.precompute).build()?; + .precompute(cli.precompute) + .build()?; Ok(()) } @@ -31,8 +35,10 @@ fn main() -> anyhow::Result<()> { fn get_word(cli: &Cli) -> String { let mut word = String::new(); - todo!("get user input"); - todo!("validate user input"); + // TODO: get user input + // TODO: validate user input + + todo!(); assert_eq!(word.len(), cli.length); word diff --git a/src/bin/game/tui.rs b/src/bin/game/tui.rs index e69de29..f2829d1 100644 --- a/src/bin/game/tui.rs +++ b/src/bin/game/tui.rs @@ -0,0 +1,6 @@ +#![warn(clippy::all)] +#![warn(missing_docs)] +#![warn(missing_debug_implementations)] +fn main() { + unimplemented!(); +} diff --git a/src/game/mod.rs b/src/game/mod.rs index 98f94b6..0226c0d 100644 --- a/src/game/mod.rs +++ b/src/game/mod.rs @@ -1,3 +1,4 @@ +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Game { length: usize, precompute: bool, @@ -42,14 +43,7 @@ impl Game { } } -impl Default for Game { - fn default() -> Self { - GameBuilder::default() - .build() - .expect("could not build game with defaults") - } -} - +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct GameBuilder { length: usize, precompute: bool, diff --git a/src/lib.rs b/src/lib.rs index 79a48d1..8226925 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,10 @@ +#![warn(clippy::all)] +#![warn(missing_docs)] +#![warn(missing_debug_implementations)] + +/// Default letters of a solution word pub const DEFAULT_WORD_LENGTH: usize = 5; +/// Default amount of guesses per game pub const DEFAULT_MAX_STEPS: usize = 6; pub mod game;