diff --git a/kurobako_core/src/registry.rs b/kurobako_core/src/registry.rs index 3139f1a..023658d 100644 --- a/kurobako_core/src/registry.rs +++ b/kurobako_core/src/registry.rs @@ -6,12 +6,14 @@ use crate::solver::{BoxSolverFactory, SolverRecipe}; use crate::{Error, Result}; use std::fmt; +type CreateProblemFactory = + dyn Fn(&JsonRecipe, &FactoryRegistry) -> Result + Send; +type CreateSolverFactory = dyn Fn(&JsonRecipe, &FactoryRegistry) -> Result + Send; + /// Factory registry. pub struct FactoryRegistry { - create_problem_factory: - Box Result + Send>, - create_solver_factory: - Box Result + Send>, + create_problem_factory: Box, + create_solver_factory: Box, } impl FactoryRegistry { /// Makes a new `FactoryRegistry` instance. diff --git a/kurobako_core/src/rng.rs b/kurobako_core/src/rng.rs index 5e4d66e..3fccf53 100644 --- a/kurobako_core/src/rng.rs +++ b/kurobako_core/src/rng.rs @@ -13,7 +13,7 @@ impl ArcRng { /// Makes a new `ArcRng` with the given random seed. pub fn new(seed: u64) -> Self { let mut seed256 = [0; 32]; - (&mut seed256[0..8]).copy_from_slice(&seed.to_be_bytes()); + seed256[0..8].copy_from_slice(&seed.to_be_bytes()); let inner = StdRng::from_seed(seed256); Self(Arc::new(Mutex::new(inner))) diff --git a/kurobako_core/src/trial.rs b/kurobako_core/src/trial.rs index f66364b..61117c7 100644 --- a/kurobako_core/src/trial.rs +++ b/kurobako_core/src/trial.rs @@ -169,16 +169,14 @@ impl PartialOrd for Values { fn partial_cmp(&self, other: &Self) -> Option { let mut ord = None; for (a, b) in self.0.iter().zip(other.0.iter()) { - if ord == None { + if ord.is_none() { ord = a.partial_cmp(b); - if ord == None { - return None; - } + ord?; } else if ord != a.partial_cmp(b) { return None; } } - if ord == None { + if ord.is_none() { Some(Ordering::Equal) // Both instances are empty. } else { ord diff --git a/kurobako_problems/src/sigopt.rs b/kurobako_problems/src/sigopt.rs index 40c9022..ce6064a 100644 --- a/kurobako_problems/src/sigopt.rs +++ b/kurobako_problems/src/sigopt.rs @@ -6,6 +6,7 @@ //! If you want to use an unimplemented function, please create an issue or PR. //! //! [sigopt/evalset]: https://github.com/sigopt/evalset +#![allow(clippy::format_push_string)] use self::functions::TestFunction; use kurobako_core::domain; use kurobako_core::problem::{ diff --git a/src/markdown.rs b/src/markdown.rs index 9646868..4d73cf3 100644 --- a/src/markdown.rs +++ b/src/markdown.rs @@ -29,7 +29,7 @@ impl<'a, W: Write> MarkdownWriter<'a, W> { } pub fn inner_mut(&mut self) -> &mut W { - &mut self.writer + self.writer } pub fn newline(&mut self) -> Result<()> { diff --git a/src/plot/curve.rs b/src/plot/curve.rs index 9f89d00..9f158fd 100644 --- a/src/plot/curve.rs +++ b/src/plot/curve.rs @@ -1,4 +1,5 @@ //! `kurobako plot curve` command. +#![allow(clippy::format_push_string)] use super::{execute_gnuplot, normalize_filename}; use crate::record::{ProblemRecord, StudyRecord}; use indicatif::{ProgressBar, ProgressStyle}; diff --git a/src/plot/pareto_front.rs b/src/plot/pareto_front.rs index 32a8418..bacd04c 100644 --- a/src/plot/pareto_front.rs +++ b/src/plot/pareto_front.rs @@ -1,4 +1,5 @@ //! `kurobako plot pareto-front` command. +#![allow(clippy::format_push_string)] use super::{execute_gnuplot, normalize_filename}; use crate::record::StudyRecord; use indicatif::{ProgressBar, ProgressStyle}; diff --git a/src/plot/slice.rs b/src/plot/slice.rs index d5e544c..1738663 100644 --- a/src/plot/slice.rs +++ b/src/plot/slice.rs @@ -1,4 +1,5 @@ //! `kurobako plot slice` command. +#![allow(clippy::format_push_string)] use super::{execute_gnuplot, normalize_filename}; use crate::record::StudyRecord; use indicatif::{ProgressBar, ProgressStyle};