Skip to content

Commit

Permalink
Nightly clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
Joris Bayer authored and stefan-k committed Mar 24, 2024
1 parent 35e00e2 commit 73c52ce
Show file tree
Hide file tree
Showing 37 changed files with 16 additions and 63 deletions.
1 change: 0 additions & 1 deletion crates/argmin-checkpointing-file/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
pub use argmin::core::checkpointing::{Checkpoint, CheckpointingFrequency};
use argmin::core::Error;
use serde::{de::DeserializeOwned, Serialize};
use std::default::Default;
use std::fs::File;
use std::io::{BufReader, BufWriter};
use std::path::PathBuf;
Expand Down
1 change: 0 additions & 1 deletion crates/argmin/src/core/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use crate::core::observers::{Observe, ObserverMode, Observers};
use crate::core::{
Error, OptimizationResult, Problem, Solver, State, TerminationReason, TerminationStatus, KV,
};
use instant;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;

Expand Down
1 change: 0 additions & 1 deletion crates/argmin/src/core/state/iterstate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// copied, modified, or distributed except according to those terms.

use crate::core::{ArgminFloat, Problem, State, TerminationReason, TerminationStatus};
use instant;
#[cfg(feature = "serde1")]
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/argmin/src/core/state/linearprogramstate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// copied, modified, or distributed except according to those terms.

use crate::core::{ArgminFloat, Problem, State, TerminationReason, TerminationStatus};
use instant;
#[cfg(feature = "serde1")]
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/argmin/src/core/state/populationstate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// copied, modified, or distributed except according to those terms.

use crate::core::{ArgminFloat, Problem, State, TerminationReason, TerminationStatus};
use instant;
#[cfg(feature = "serde1")]
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/argmin/src/solver/brent/brentopt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ where
mod tests {
use super::*;
use crate::core::{Executor, TerminationStatus};
use crate::test_trait_impl;
use approx::assert_relative_eq;

test_trait_impl!(brent, BrentOpt<f64>);
Expand Down
1 change: 0 additions & 1 deletion crates/argmin/src/solver/brent/brentroot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ where
#[cfg(test)]
mod tests {
use super::*;
use crate::test_trait_impl;

test_trait_impl!(brent, BrentRoot<f64>);
}
1 change: 0 additions & 1 deletion crates/argmin/src/solver/conjugategradient/beta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ where
#[cfg(test)]
mod tests {
use super::*;
use crate::test_trait_impl;

test_trait_impl!(fletcher_reeves, FletcherReeves);
test_trait_impl!(polak_ribiere, PolakRibiere);
Expand Down
3 changes: 1 addition & 2 deletions crates/argmin/src/solver/conjugategradient/cg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ where
#[cfg(test)]
mod tests {
use super::*;
use crate::core::{test_utils::TestProblem, ArgminError, IterState, Problem};
use crate::test_trait_impl;
use crate::core::{test_utils::TestProblem, ArgminError};
use approx::assert_relative_eq;

test_trait_impl!(conjugate_gradient, ConjugateGradient<Vec<f64>, f64>);
Expand Down
4 changes: 1 addition & 3 deletions crates/argmin/src/solver/conjugategradient/nonlinear_cg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,17 +228,15 @@ where
}

#[cfg(test)]
#[allow(clippy::let_unit_value)]
mod tests {
#![allow(clippy::let_unit_value)]

use super::*;
use crate::core::test_utils::TestProblem;
use crate::core::ArgminError;
use crate::solver::conjugategradient::beta::PolakRibiere;
use crate::solver::linesearch::{
condition::ArmijoCondition, BacktrackingLineSearch, MoreThuenteLineSearch,
};
use crate::test_trait_impl;
use approx::assert_relative_eq;

#[derive(Eq, PartialEq, Clone, Copy, Debug)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,13 @@ where
}

#[cfg(test)]
#[allow(clippy::let_unit_value)]
mod tests {
#![allow(clippy::let_unit_value)]

use super::*;
use crate::core::ArgminError;
#[cfg(feature = "_ndarrayl")]
use crate::core::{IterState, State};
use crate::core::State;
use crate::solver::linesearch::{condition::ArmijoCondition, BacktrackingLineSearch};
use crate::{assert_error, test_trait_impl};
#[cfg(feature = "_ndarrayl")]
use approx::assert_relative_eq;

Expand Down
1 change: 0 additions & 1 deletion crates/argmin/src/solver/gaussnewton/gaussnewton_method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ mod tests {
use crate::core::ArgminError;
#[cfg(feature = "_ndarrayl")]
use crate::core::Executor;
use crate::test_trait_impl;
#[cfg(feature = "_ndarrayl")]
use approx::assert_relative_eq;

Expand Down
1 change: 0 additions & 1 deletion crates/argmin/src/solver/goldensectionsearch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ where
mod tests {
use super::*;
use crate::core::{ArgminError, State};
use crate::test_trait_impl;
use approx::assert_relative_eq;

#[derive(Clone)]
Expand Down
3 changes: 1 addition & 2 deletions crates/argmin/src/solver/gradientdescent/steepestdescent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,10 @@ where
mod tests {
use super::*;
use crate::core::test_utils::TestProblem;
use crate::core::{ArgminError, State};
use crate::core::ArgminError;
use crate::solver::linesearch::{
condition::ArmijoCondition, BacktrackingLineSearch, MoreThuenteLineSearch,
};
use crate::test_trait_impl;
use approx::assert_relative_eq;

test_trait_impl!(
Expand Down
3 changes: 1 addition & 2 deletions crates/argmin/src/solver/landweber/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ where
#[cfg(test)]
mod tests {
use super::*;
use crate::core::{test_utils::TestProblem, ArgminError, Problem, State};
use crate::test_trait_impl;
use crate::core::{test_utils::TestProblem, ArgminError, State};
use approx::assert_relative_eq;

test_trait_impl!(landweber, Landweber<f64>);
Expand Down
4 changes: 1 addition & 3 deletions crates/argmin/src/solver/linesearch/backtracking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,7 @@ where
#[cfg(test)]
mod tests {
use super::*;
use crate::assert_error;
use crate::core::{test_utils::TestProblem, ArgminError, Executor, State};
use crate::test_trait_impl;
use crate::core::{test_utils::TestProblem, ArgminError, Executor};
use approx::assert_relative_eq;
use num_traits::Float;

Expand Down
2 changes: 0 additions & 2 deletions crates/argmin/src/solver/linesearch/condition/armijo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ where
#[cfg(test)]
mod tests {
use super::*;
use crate::assert_error;
use crate::core::ArgminError;
use crate::test_trait_impl;

test_trait_impl!(armijo, ArmijoCondition<f64>);

Expand Down
2 changes: 0 additions & 2 deletions crates/argmin/src/solver/linesearch/condition/goldstein.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ where
#[cfg(test)]
mod tests {
use super::*;
use crate::assert_error;
use crate::core::ArgminError;
use crate::test_trait_impl;

test_trait_impl!(goldstein, GoldsteinCondition<f64>);

Expand Down
2 changes: 0 additions & 2 deletions crates/argmin/src/solver/linesearch/condition/strongwolfe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ where
#[cfg(test)]
mod tests {
use super::*;
use crate::assert_error;
use crate::core::ArgminError;
use crate::test_trait_impl;

test_trait_impl!(strongwolfe, StrongWolfeCondition<f64>);

Expand Down
2 changes: 0 additions & 2 deletions crates/argmin/src/solver/linesearch/condition/wolfe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ where
#[cfg(test)]
mod tests {
use super::*;
use crate::assert_error;
use crate::core::ArgminError;
use crate::test_trait_impl;

test_trait_impl!(wolfe, WolfeCondition<f64>);

Expand Down
3 changes: 1 addition & 2 deletions crates/argmin/src/solver/linesearch/hagerzhang.rs
Original file line number Diff line number Diff line change
Expand Up @@ -641,8 +641,7 @@ where
#[cfg(test)]
mod tests {
use super::*;
use crate::core::{test_utils::TestProblem, ArgminError, IterState, Problem, State};
use crate::test_trait_impl;
use crate::core::{test_utils::TestProblem, ArgminError, State};

test_trait_impl!(hagerzhang, HagerZhangLineSearch<Vec<f64>, Vec<f64>, f64>);

Expand Down
4 changes: 1 addition & 3 deletions crates/argmin/src/solver/linesearch/morethuente.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use crate::core::{
use argmin_math::{ArgminDot, ArgminScaledAdd};
#[cfg(feature = "serde1")]
use serde::{Deserialize, Serialize};
use std::default::Default;

/// # More-Thuente line search
///
Expand Down Expand Up @@ -721,8 +720,7 @@ fn cstep<F: ArgminFloat>(
#[cfg(test)]
mod tests {
use super::*;
use crate::core::{test_utils::TestProblem, ArgminError, IterState, Problem};
use crate::test_trait_impl;
use crate::core::{test_utils::TestProblem, ArgminError};

test_trait_impl!(morethuente, MoreThuenteLineSearch<Vec<f64>, Vec<f64>, f64>);

Expand Down
3 changes: 1 addition & 2 deletions crates/argmin/src/solver/neldermead/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,7 @@ where
#[cfg(test)]
mod tests {
use super::*;
use crate::core::{test_utils::TestProblem, ArgminError, IterState, State};
use crate::test_trait_impl;
use crate::core::{test_utils::TestProblem, ArgminError, State};
use approx::assert_relative_eq;

test_trait_impl!(nelder_mead, NelderMead<TestProblem, f64>);
Expand Down
4 changes: 1 addition & 3 deletions crates/argmin/src/solver/newton/newton_cg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,11 @@ where
}

#[cfg(test)]
#[allow(clippy::let_unit_value)]
mod tests {
#![allow(clippy::let_unit_value)]

use super::*;
use crate::core::{test_utils::TestProblem, ArgminError};
use crate::solver::linesearch::MoreThuenteLineSearch;
use crate::test_trait_impl;

test_trait_impl!(
newton_cg,
Expand Down
2 changes: 0 additions & 2 deletions crates/argmin/src/solver/newton/newton_method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use crate::core::{ArgminFloat, Error, Gradient, Hessian, IterState, Problem, Sol
use argmin_math::{ArgminDot, ArgminInv, ArgminScaledSub};
#[cfg(feature = "serde1")]
use serde::{Deserialize, Serialize};
use std::default::Default;

/// # Newton's method
///
Expand Down Expand Up @@ -119,7 +118,6 @@ mod tests {
use crate::core::ArgminError;
#[cfg(feature = "_ndarrayl")]
use crate::core::Executor;
use crate::test_trait_impl;
#[cfg(feature = "_ndarrayl")]
use approx::assert_relative_eq;

Expand Down
1 change: 0 additions & 1 deletion crates/argmin/src/solver/particleswarm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,6 @@ where
mod tests {
use super::*;
use crate::core::{test_utils::TestProblem, ArgminError, State};
use crate::test_trait_impl;
use approx::assert_relative_eq;

test_trait_impl!(
Expand Down
3 changes: 1 addition & 2 deletions crates/argmin/src/solver/quasinewton/bfgs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,8 @@ where
#[cfg(test)]
mod tests {
use super::*;
use crate::core::{test_utils::TestProblem, ArgminError, IterState, State};
use crate::core::{test_utils::TestProblem, ArgminError, State};
use crate::solver::linesearch::MoreThuenteLineSearch;
use crate::test_trait_impl;

test_trait_impl!(
bfgs,
Expand Down
3 changes: 1 addition & 2 deletions crates/argmin/src/solver/quasinewton/dfp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,8 @@ where
#[cfg(test)]
mod tests {
use super::*;
use crate::core::{test_utils::TestProblem, ArgminError, IterState, State};
use crate::core::{test_utils::TestProblem, ArgminError, State};
use crate::solver::linesearch::MoreThuenteLineSearch;
use crate::test_trait_impl;

test_trait_impl!(
dfp,
Expand Down
3 changes: 1 addition & 2 deletions crates/argmin/src/solver/quasinewton/lbfgs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -517,10 +517,9 @@ mod tests {
use super::*;
use crate::core::{
test_utils::{TestProblem, TestSparseProblem},
ArgminError, IterState, State,
ArgminError,
};
use crate::solver::linesearch::MoreThuenteLineSearch;
use crate::test_trait_impl;

test_trait_impl!(
lbfgs,
Expand Down
3 changes: 1 addition & 2 deletions crates/argmin/src/solver/quasinewton/sr1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,8 @@ where
#[cfg(test)]
mod tests {
use super::*;
use crate::core::{test_utils::TestProblem, ArgminError, IterState, State};
use crate::core::{test_utils::TestProblem, ArgminError, State};
use crate::solver::linesearch::MoreThuenteLineSearch;
use crate::test_trait_impl;

test_trait_impl!(
sr1,
Expand Down
3 changes: 1 addition & 2 deletions crates/argmin/src/solver/quasinewton/sr1_trustregion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,8 @@ where
#[cfg(test)]
mod tests {
use super::*;
use crate::core::{test_utils::TestProblem, ArgminError, IterState, State};
use crate::core::{test_utils::TestProblem, ArgminError, State};
use crate::solver::trustregion::CauchyPoint;
use crate::test_trait_impl;

test_trait_impl!(sr1, SR1TrustRegion<CauchyPoint<f64>, f64>);

Expand Down
1 change: 0 additions & 1 deletion crates/argmin/src/solver/simulatedannealing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,6 @@ where
mod tests {
use super::*;
use crate::core::{test_utils::TestProblem, ArgminError, State};
use crate::test_trait_impl;
use approx::assert_relative_eq;

test_trait_impl!(sa, SimulatedAnnealing<f64, StdRng>);
Expand Down
1 change: 0 additions & 1 deletion crates/argmin/src/solver/trustregion/cauchypoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ where
mod tests {
use super::*;
use crate::core::{test_utils::TestProblem, ArgminError};
use crate::test_trait_impl;
use approx::assert_relative_eq;

test_trait_impl!(cauchypoint, CauchyPoint<f64>);
Expand Down
1 change: 0 additions & 1 deletion crates/argmin/src/solver/trustregion/dogleg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ mod tests {
use super::*;
#[cfg(feature = "_ndarrayl")]
use crate::core::ArgminError;
use crate::test_trait_impl;

test_trait_impl!(dogleg, Dogleg<f64>);

Expand Down
1 change: 0 additions & 1 deletion crates/argmin/src/solver/trustregion/steihaug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ mod tests {
use super::*;
use crate::core::test_utils::TestProblem;
use crate::core::ArgminError;
use crate::test_trait_impl;
use approx::assert_relative_eq;

test_trait_impl!(steihaug, Steihaug<TestProblem, f64>);
Expand Down
1 change: 0 additions & 1 deletion crates/argmin/src/solver/trustregion/trustregion_method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ mod tests {
use crate::core::test_utils::TestProblem;
use crate::core::{ArgminError, State};
use crate::solver::trustregion::{CauchyPoint, Steihaug};
use crate::test_trait_impl;

test_trait_impl!(trustregion, TrustRegion<Steihaug<TestProblem, f64>, f64>);

Expand Down
1 change: 0 additions & 1 deletion crates/argmin/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

use approx::assert_relative_eq;
use ndarray::prelude::*;
use ndarray::{Array1, Array2};

use crate::core::{CostFunction, Error, Executor, Gradient, Hessian, State};
use crate::solver::gradientdescent::SteepestDescent;
Expand Down

0 comments on commit 73c52ce

Please sign in to comment.