Skip to content

Commit

Permalink
fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
martinjrobins committed Nov 29, 2024
1 parent 512079f commit 88ca6f3
Show file tree
Hide file tree
Showing 18 changed files with 51 additions and 49 deletions.
2 changes: 2 additions & 0 deletions src/jacobian/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ mod tests {
use num_traits::{One, Zero};
use std::ops::MulAssign;

#[allow(clippy::type_complexity)]
fn helper_triplets2op_nonlinear<'a, M: Matrix + 'a>(
triplets: &'a [(usize, usize, M::T)],
p: &'a M::V,
Expand Down Expand Up @@ -271,6 +272,7 @@ mod tests {
ret
}

#[allow(clippy::type_complexity)]
fn helper_triplets2op_linear<'a, M: Matrix + 'a>(
triplets: &'a [(usize, usize, M::T)],
p: &'a M::V,
Expand Down
8 changes: 4 additions & 4 deletions src/ode_solver/adjoint_equations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ where
}
}

impl<'a, Eqn> Op for AdjointMass<'a, Eqn>
impl<Eqn> Op for AdjointMass<'_, Eqn>
where
Eqn: OdeEquationsAdjoint,
{
Expand All @@ -103,7 +103,7 @@ where
}
}

impl<'a, Eqn> LinearOp for AdjointMass<'a, Eqn>
impl<Eqn> LinearOp for AdjointMass<'_, Eqn>
where
Eqn: OdeEquationsAdjoint,
{
Expand Down Expand Up @@ -135,7 +135,7 @@ where
}
}

impl<'a, Eqn> Op for AdjointInit<'a, Eqn>
impl<Eqn> Op for AdjointInit<'_, Eqn>
where
Eqn: OdeEquationsAdjoint,
{
Expand All @@ -154,7 +154,7 @@ where
}
}

impl<'a, Eqn> ConstantOp for AdjointInit<'a, Eqn>
impl<Eqn> ConstantOp for AdjointInit<'_, Eqn>
where
Eqn: OdeEquationsAdjoint,
{
Expand Down
2 changes: 1 addition & 1 deletion src/ode_solver/bdf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ pub struct Bdf<
jacobian_update: JacobianUpdate<Eqn::T>,
}

impl<'a, M, Eqn, Nls, AugmentedEqn> Clone for Bdf<'a, Eqn, Nls, M, AugmentedEqn>
impl<M, Eqn, Nls, AugmentedEqn> Clone for Bdf<'_, Eqn, Nls, M, AugmentedEqn>
where
Eqn: OdeEquationsImplicit,
Nls: NonLinearSolver<Eqn::M>,
Expand Down
2 changes: 1 addition & 1 deletion src/ode_solver/equations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ pub trait OdeEquationsRef<'a, ImplicitBounds: Sealed = Bounds<&'a Self>>: Op {
type Out: NonLinearOp<M = Self::M, V = Self::V, T = Self::T>;
}

impl<'a, 'b, T: OdeEquationsRef<'a>> OdeEquationsRef<'a> for &'b T {
impl<'a, T: OdeEquationsRef<'a>> OdeEquationsRef<'a> for &T {
type Mass = <T as OdeEquationsRef<'a>>::Mass;
type Rhs = <T as OdeEquationsRef<'a>>::Rhs;
type Root = <T as OdeEquationsRef<'a>>::Root;
Expand Down
2 changes: 1 addition & 1 deletion src/ode_solver/sdirk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ pub struct Sdirk<
jacobian_update: JacobianUpdate<Eqn::T>,
}

impl<'a, M, Eqn, LS, AugmentedEqn> Clone for Sdirk<'a, Eqn, LS, M, AugmentedEqn>
impl<M, Eqn, LS, AugmentedEqn> Clone for Sdirk<'_, Eqn, LS, M, AugmentedEqn>
where
M: DenseMatrix<T = Eqn::T, V = Eqn::V>,
LS: LinearSolver<Eqn::M>,
Expand Down
18 changes: 9 additions & 9 deletions src/ode_solver/sens_equations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ where
}
}

impl<'a, Eqn> Op for SensInit<'a, Eqn>
impl<Eqn> Op for SensInit<'_, Eqn>
where
Eqn: OdeEquationsSens,
{
Expand All @@ -58,7 +58,7 @@ where
}
}

impl<'a, Eqn> ConstantOp for SensInit<'a, Eqn>
impl<Eqn> ConstantOp for SensInit<'_, Eqn>
where
Eqn: OdeEquationsSens,
{
Expand Down Expand Up @@ -133,7 +133,7 @@ where
}
}

impl<'a, Eqn> Op for SensRhs<'a, Eqn>
impl<Eqn> Op for SensRhs<'_, Eqn>
where
Eqn: OdeEquationsSens,
{
Expand All @@ -152,7 +152,7 @@ where
}
}

impl<'a, Eqn> NonLinearOp for SensRhs<'a, Eqn>
impl<Eqn> NonLinearOp for SensRhs<'_, Eqn>
where
Eqn: OdeEquationsSens,
{
Expand All @@ -166,7 +166,7 @@ where
}
}

impl<'a, Eqn> NonLinearOpJacobian for SensRhs<'a, Eqn>
impl<Eqn> NonLinearOpJacobian for SensRhs<'_, Eqn>
where
Eqn: OdeEquationsSens,
{
Expand Down Expand Up @@ -205,7 +205,7 @@ where
rtol: Option<Eqn::T>,
}

impl<'a, Eqn> Clone for SensEquations<'a, Eqn>
impl<Eqn> Clone for SensEquations<'_, Eqn>
where
Eqn: OdeEquationsSens,
{
Expand All @@ -220,7 +220,7 @@ where
}
}

impl<'a, Eqn> std::fmt::Debug for SensEquations<'a, Eqn>
impl<Eqn> std::fmt::Debug for SensEquations<'_, Eqn>
where
Eqn: OdeEquationsSens,
{
Expand Down Expand Up @@ -249,7 +249,7 @@ where
}
}

impl<'a, Eqn> Op for SensEquations<'a, Eqn>
impl<Eqn> Op for SensEquations<'_, Eqn>
where
Eqn: OdeEquationsSens,
{
Expand Down Expand Up @@ -303,7 +303,7 @@ where
}
}

impl<'a, Eqn: OdeEquationsSens> AugmentedOdeEquations<Eqn> for SensEquations<'a, Eqn> {
impl<Eqn: OdeEquationsSens> AugmentedOdeEquations<Eqn> for SensEquations<'_, Eqn> {
fn include_in_error_control(&self) -> bool {
self.rtol.is_some() && self.atol.is_some()
}
Expand Down
4 changes: 2 additions & 2 deletions src/op/closure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ where
}
}

impl<'a, M, F, G> NonLinearOp for ParameterisedOp<'a, Closure<M, F, G>>
impl<M, F, G> NonLinearOp for ParameterisedOp<'_, Closure<M, F, G>>
where
M: Matrix,
F: Fn(&M::V, &M::V, M::T, &mut M::V),
Expand All @@ -111,7 +111,7 @@ where
}
}

impl<'a, M, F, G> NonLinearOpJacobian for ParameterisedOp<'a, Closure<M, F, G>>
impl<M, F, G> NonLinearOpJacobian for ParameterisedOp<'_, Closure<M, F, G>>
where
M: Matrix,
F: Fn(&M::V, &M::V, M::T, &mut M::V),
Expand Down
2 changes: 1 addition & 1 deletion src/op/closure_no_jac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ where
}
}

impl<'a, M, F> NonLinearOp for ParameterisedOp<'a, ClosureNoJac<M, F>>
impl<M, F> NonLinearOp for ParameterisedOp<'_, ClosureNoJac<M, F>>
where
M: Matrix,
F: Fn(&M::V, &M::V, M::T, &mut M::V),
Expand Down
14 changes: 7 additions & 7 deletions src/op/closure_with_adjoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ where
}
}

impl<'a, M, F, G, H, I> NonLinearOp for ParameterisedOp<'a, ClosureWithAdjoint<M, F, G, H, I>>
impl<M, F, G, H, I> NonLinearOp for ParameterisedOp<'_, ClosureWithAdjoint<M, F, G, H, I>>
where
M: Matrix,
F: Fn(&M::V, &M::V, M::T, &mut M::V),
Expand All @@ -175,8 +175,8 @@ where
}
}

impl<'a, M, F, G, H, I> NonLinearOpJacobian
for ParameterisedOp<'a, ClosureWithAdjoint<M, F, G, H, I>>
impl<M, F, G, H, I> NonLinearOpJacobian
for ParameterisedOp<'_, ClosureWithAdjoint<M, F, G, H, I>>
where
M: Matrix,
F: Fn(&M::V, &M::V, M::T, &mut M::V),
Expand All @@ -201,8 +201,8 @@ where
}
}

impl<'a, M, F, G, H, I> NonLinearOpAdjoint
for ParameterisedOp<'a, ClosureWithAdjoint<M, F, G, H, I>>
impl<M, F, G, H, I> NonLinearOpAdjoint
for ParameterisedOp<'_, ClosureWithAdjoint<M, F, G, H, I>>
where
M: Matrix,
F: Fn(&M::V, &M::V, M::T, &mut M::V),
Expand All @@ -227,8 +227,8 @@ where
}
}

impl<'a, M, F, G, H, I> NonLinearOpSensAdjoint
for ParameterisedOp<'a, ClosureWithAdjoint<M, F, G, H, I>>
impl<M, F, G, H, I> NonLinearOpSensAdjoint
for ParameterisedOp<'_, ClosureWithAdjoint<M, F, G, H, I>>
where
M: Matrix,
F: Fn(&M::V, &M::V, M::T, &mut M::V),
Expand Down
6 changes: 3 additions & 3 deletions src/op/closure_with_sens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ where
}
}

impl<'a, M, F, G, H> NonLinearOp for ParameterisedOp<'a, ClosureWithSens<M, F, G, H>>
impl<M, F, G, H> NonLinearOp for ParameterisedOp<'_, ClosureWithSens<M, F, G, H>>
where
M: Matrix,
F: Fn(&M::V, &M::V, M::T, &mut M::V),
Expand All @@ -138,7 +138,7 @@ where
}
}

impl<'a, M, F, G, H> NonLinearOpJacobian for ParameterisedOp<'a, ClosureWithSens<M, F, G, H>>
impl<M, F, G, H> NonLinearOpJacobian for ParameterisedOp<'_, ClosureWithSens<M, F, G, H>>
where
M: Matrix,
F: Fn(&M::V, &M::V, M::T, &mut M::V),
Expand All @@ -162,7 +162,7 @@ where
}
}

impl<'a, M, F, G, H> NonLinearOpSens for ParameterisedOp<'a, ClosureWithSens<M, F, G, H>>
impl<M, F, G, H> NonLinearOpSens for ParameterisedOp<'_, ClosureWithSens<M, F, G, H>>
where
M: Matrix,
F: Fn(&M::V, &M::V, M::T, &mut M::V),
Expand Down
2 changes: 1 addition & 1 deletion src/op/constant_closure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ where
}
}

impl<'a, M, I> ConstantOp for ParameterisedOp<'a, ConstantClosure<M, I>>
impl<M, I> ConstantOp for ParameterisedOp<'_, ConstantClosure<M, I>>
where
M: Matrix,
I: Fn(&M::V, M::T) -> M::V,
Expand Down
4 changes: 2 additions & 2 deletions src/op/constant_closure_with_adjoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ where
}
}

impl<'a, M, I, J> ConstantOp for ParameterisedOp<'a, ConstantClosureWithAdjoint<M, I, J>>
impl<M, I, J> ConstantOp for ParameterisedOp<'_, ConstantClosureWithAdjoint<M, I, J>>
where
M: Matrix,
I: Fn(&M::V, M::T) -> M::V,
Expand All @@ -86,7 +86,7 @@ where
}
}

impl<'a, M, I, J> ConstantOpSensAdjoint for ParameterisedOp<'a, ConstantClosureWithAdjoint<M, I, J>>
impl<M, I, J> ConstantOpSensAdjoint for ParameterisedOp<'_, ConstantClosureWithAdjoint<M, I, J>>
where
M: Matrix,
I: Fn(&M::V, M::T) -> M::V,
Expand Down
4 changes: 2 additions & 2 deletions src/op/constant_closure_with_sens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ where
}
}

impl<'a, M, I, J> ConstantOp for ParameterisedOp<'a, ConstantClosureWithSens<M, I, J>>
impl<M, I, J> ConstantOp for ParameterisedOp<'_, ConstantClosureWithSens<M, I, J>>
where
M: Matrix,
I: Fn(&M::V, M::T) -> M::V,
Expand All @@ -86,7 +86,7 @@ where
}
}

impl<'a, M, I, J> ConstantOpSens for ParameterisedOp<'a, ConstantClosureWithSens<M, I, J>>
impl<M, I, J> ConstantOpSens for ParameterisedOp<'_, ConstantClosureWithSens<M, I, J>>
where
M: Matrix,
I: Fn(&M::V, M::T) -> M::V,
Expand Down
6 changes: 3 additions & 3 deletions src/op/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl<'a, Eqn: OdeEquationsImplicit> InitOp<'a, Eqn> {
}
}

impl<'a, Eqn: OdeEquationsImplicit> Op for InitOp<'a, Eqn> {
impl<Eqn: OdeEquationsImplicit> Op for InitOp<'_, Eqn> {
type V = Eqn::V;
type T = Eqn::T;
type M = Eqn::M;
Expand All @@ -85,7 +85,7 @@ impl<'a, Eqn: OdeEquationsImplicit> Op for InitOp<'a, Eqn> {
}
}

impl<'a, Eqn: OdeEquationsImplicit> NonLinearOp for InitOp<'a, Eqn> {
impl<Eqn: OdeEquationsImplicit> NonLinearOp for InitOp<'_, Eqn> {
// -M_u du + f(u, v)
// g(t, u, v)
fn call_inplace(&self, x: &Eqn::V, t: Eqn::T, y: &mut Eqn::V) {
Expand All @@ -102,7 +102,7 @@ impl<'a, Eqn: OdeEquationsImplicit> NonLinearOp for InitOp<'a, Eqn> {
}
}

impl<'a, Eqn: OdeEquationsImplicit> NonLinearOpJacobian for InitOp<'a, Eqn> {
impl<Eqn: OdeEquationsImplicit> NonLinearOpJacobian for InitOp<'_, Eqn> {
// J v
fn jac_mul_inplace(&self, _x: &Eqn::V, _t: Eqn::T, v: &Eqn::V, y: &mut Eqn::V) {
self.jac.gemv(Eqn::T::one(), v, Eqn::T::one(), y);
Expand Down
2 changes: 1 addition & 1 deletion src/op/linear_closure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ where
}
}

impl<'a, M, F> LinearOp for ParameterisedOp<'a, LinearClosure<M, F>>
impl<M, F> LinearOp for ParameterisedOp<'_, LinearClosure<M, F>>
where
M: Matrix,
F: Fn(&M::V, &M::V, M::T, M::T, &mut M::V),
Expand Down
4 changes: 2 additions & 2 deletions src/op/linear_closure_with_adjoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ where
}
}

impl<'a, M, F, G> LinearOp for ParameterisedOp<'a, LinearClosureWithAdjoint<M, F, G>>
impl<M, F, G> LinearOp for ParameterisedOp<'_, LinearClosureWithAdjoint<M, F, G>>
where
M: Matrix,
F: Fn(&M::V, &M::V, M::T, M::T, &mut M::V),
Expand All @@ -141,7 +141,7 @@ where
}
}

impl<'a, M, F, G> LinearOpTranspose for ParameterisedOp<'a, LinearClosureWithAdjoint<M, F, G>>
impl<M, F, G> LinearOpTranspose for ParameterisedOp<'_, LinearClosureWithAdjoint<M, F, G>>
where
M: Matrix,
F: Fn(&M::V, &M::V, M::T, M::T, &mut M::V),
Expand Down
2 changes: 1 addition & 1 deletion src/op/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub trait BuilderOp: Op {
fn calculate_sparsity(&mut self, y0: &Self::V, t0: Self::T, p: &Self::V);
}

impl<'a, C: Op> Op for ParameterisedOp<'a, C> {
impl<C: Op> Op for ParameterisedOp<'_, C> {
type V = C::V;
type T = C::T;
type M = C::M;
Expand Down
Loading

0 comments on commit 88ca6f3

Please sign in to comment.