From 5f32f8227fe551dee8d61fd0fdad72bf362034a0 Mon Sep 17 00:00:00 2001 From: cscherrNT Date: Mon, 22 Jul 2024 10:33:57 +0000 Subject: [PATCH] automatic cargo CI changes --- src/bench/report.rs | 9 ++------- src/bin/bench/cli.rs | 2 -- src/error.rs | 2 +- src/game/mod.rs | 2 +- src/game/response.rs | 4 +--- src/game/summary.rs | 6 ++++++ src/solve/mod.rs | 2 +- src/solve/naive/mod.rs | 2 +- src/wlist/mod.rs | 3 +-- src/wlist/word.rs | 16 ++++++++++------ 10 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/bench/report.rs b/src/bench/report.rs index c6b0c58..e01098d 100644 --- a/src/bench/report.rs +++ b/src/bench/report.rs @@ -1,12 +1,7 @@ -use chrono::{self, Duration, NaiveDateTime, NaiveTime, TimeDelta}; -use core::panic; +use chrono::{self, NaiveDateTime, TimeDelta}; use libpt::log::debug; -use std::fmt::Display; -use std::ops::Div; use rayon::prelude::*; - -#[cfg(feature = "serde")] -use serde::{Deserialize, Serialize}; +use std::fmt::Display; use crate::game::response::GuessResponse; use crate::game::Game; diff --git a/src/bin/bench/cli.rs b/src/bin/bench/cli.rs index 9b88ac0..c153eb6 100644 --- a/src/bin/bench/cli.rs +++ b/src/bin/bench/cli.rs @@ -8,9 +8,7 @@ use clap::Parser; use libpt::log::*; use wordle_analyzer::bench::builtin::BuiltinBenchmark; -use wordle_analyzer::bench::report::Report; use wordle_analyzer::bench::{Benchmark, DEFAULT_N}; -use wordle_analyzer::error::WResult; use wordle_analyzer::game::GameBuilder; use wordle_analyzer::solve::{AnyBuiltinSolver, BuiltinSolverNames, Solver}; use wordle_analyzer::wlist::builtin::BuiltinWList; diff --git a/src/error.rs b/src/error.rs index 6145454..dbed13d 100644 --- a/src/error.rs +++ b/src/error.rs @@ -51,5 +51,5 @@ pub enum GameError { #[derive(Debug, Clone, Error)] pub enum BenchError { #[error("Trying to modify a finished report")] - ModifyFinishedReport + ModifyFinishedReport, } diff --git a/src/game/mod.rs b/src/game/mod.rs index 592714c..e61f1ce 100644 --- a/src/game/mod.rs +++ b/src/game/mod.rs @@ -1,5 +1,5 @@ use crate::error::*; -use crate::wlist::word::{ManyWordDatas, ManyWordsRef, Word, WordData}; +use crate::wlist::word::{ManyWordsRef, Word, WordData}; use crate::wlist::WordList; use libpt::log::{debug, trace}; diff --git a/src/game/response.rs b/src/game/response.rs index 2fca898..2395e78 100644 --- a/src/game/response.rs +++ b/src/game/response.rs @@ -1,8 +1,6 @@ use crate::wlist::word::{Word, WordData}; use crate::wlist::WordList; -use anyhow::Ok; -use colored::{ColoredString, Colorize}; -use libpt::log::debug; +use colored::Colorize; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; use std::fmt::Display; diff --git a/src/game/summary.rs b/src/game/summary.rs index 21bec99..778cf3b 100644 --- a/src/game/summary.rs +++ b/src/game/summary.rs @@ -6,6 +6,12 @@ pub struct Summary<'wl, WL: WordList> { data: Vec<&'wl Game<'wl, WL>>, } +impl<'wl, WL: WordList> Default for Summary<'wl, WL> { + fn default() -> Self { + Self::new() + } +} + impl<'wl, WL: WordList> Summary<'wl, WL> { pub fn new() -> Self { Self { data: Vec::new() } diff --git a/src/solve/mod.rs b/src/solve/mod.rs index c7e08fb..d398f4f 100644 --- a/src/solve/mod.rs +++ b/src/solve/mod.rs @@ -2,7 +2,7 @@ use std::{fmt::Display, str::FromStr}; use crate::{ error::{Error, WResult}, - game::{response::*, summary::Summary, Game}, + game::{response::*, Game}, wlist::{ word::{Word, WordData}, WordList, diff --git a/src/solve/naive/mod.rs b/src/solve/naive/mod.rs index 4f5c69f..bfe7625 100644 --- a/src/solve/naive/mod.rs +++ b/src/solve/naive/mod.rs @@ -1,4 +1,4 @@ -use libpt::log::{debug, info, trace}; +use libpt::log::{info, trace}; use crate::wlist::word::{ManyWordDatas, Word}; use crate::wlist::WordList; diff --git a/src/wlist/mod.rs b/src/wlist/mod.rs index 6ed8cd1..155ec24 100644 --- a/src/wlist/mod.rs +++ b/src/wlist/mod.rs @@ -1,4 +1,3 @@ -use libpt::log::debug; use rand::seq::IteratorRandom; use regex::Regex; @@ -71,7 +70,7 @@ pub trait WordList: Clone + std::fmt::Debug + Default + Sync { fn raw_wordlist(&self) -> String { let mut buf = String::new(); for w in self.wordmap().keys() { - buf += &w; + buf += w; buf += "\n"; } buf diff --git a/src/wlist/word.rs b/src/wlist/word.rs index 9f1dc20..1defc1f 100644 --- a/src/wlist/word.rs +++ b/src/wlist/word.rs @@ -1,8 +1,7 @@ use std::collections::HashMap; use std::fmt::write; -use std::hash::Hash; -use libpt::log::{debug, trace}; +use libpt::log::trace; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; @@ -21,6 +20,12 @@ pub struct WordMap { inner: HashMap, } +impl Default for WordMap { + fn default() -> Self { + Self::new() + } +} + impl WordMap { pub fn new() -> Self { Self { @@ -68,10 +73,9 @@ impl WordMap { &self.inner } pub fn get(&self, word: I) -> Option { - match self.inner.get(&word.to_string()) { - Some(f) => Some((word.to_string(), *f)), - None => None, - } + self.inner + .get(&word.to_string()) + .map(|f| (word.to_string(), *f)) } pub fn from_absolute(abs: HashMap) -> Self { let n: f64 = abs.keys().len() as f64;