diff --git a/Cargo.toml b/Cargo.toml index 5b722f0..da5b3d0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,7 @@ name = "num-dual" version = "0.9.1" authors = ["Gernot Bauer ", "Philipp Rehner "] +rust-version = "1.81" edition = "2021" readme = "README.md" license = "MIT OR Apache-2.0" diff --git a/src/derivative.rs b/src/derivative.rs index c878ebd..d9513dd 100644 --- a/src/derivative.rs +++ b/src/derivative.rs @@ -140,7 +140,7 @@ where } impl, F> Derivative { - #[allow(clippy::self_named_constructors)] + #[expect(clippy::self_named_constructors)] pub fn derivative() -> Self { Self::some(SVector::identity()) } diff --git a/src/dual2_vec.rs b/src/dual2_vec.rs index 7fc3db7..8428f32 100644 --- a/src/dual2_vec.rs +++ b/src/dual2_vec.rs @@ -89,7 +89,7 @@ where } /// Variant of [hessian] for fallible functions. -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] pub fn try_hessian, F: DualNumFloat, E, D: Dim>( g: G, x: OVector, diff --git a/src/dual_vec.rs b/src/dual_vec.rs index 265cf71..6c055b1 100644 --- a/src/dual_vec.rs +++ b/src/dual_vec.rs @@ -146,7 +146,7 @@ where } /// Variant of [jacobian] for fallible functions. -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] pub fn try_jacobian, F: DualNumFloat, E, M: Dim, N: Dim>( g: G, x: OVector, diff --git a/src/hyperdual_vec.rs b/src/hyperdual_vec.rs index b2b38cd..45c3565 100644 --- a/src/hyperdual_vec.rs +++ b/src/hyperdual_vec.rs @@ -96,7 +96,7 @@ where /// assert_relative_eq!(d2fdxdy[0], -0.032); /// assert_relative_eq!(d2fdxdy[1], -0.024); /// ``` -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] pub fn partial_hessian, F: DualNumFloat, M: Dim, N: Dim>( g: G, x: OVector, @@ -113,7 +113,7 @@ where } /// Variant of [partial_hessian] for fallible functions. -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] pub fn try_partial_hessian, F: DualNumFloat, E, M: Dim, N: Dim>( g: G, x: OVector, diff --git a/src/hyperhyperdual.rs b/src/hyperhyperdual.rs index a0a3db5..0a64b9c 100644 --- a/src/hyperhyperdual.rs +++ b/src/hyperhyperdual.rs @@ -38,7 +38,7 @@ pub type HyperHyperDual64 = HyperHyperDual; impl, F> HyperHyperDual { /// Create a new hyper-hyper-dual number from its fields. #[inline] - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] pub fn new( re: T, eps1: T, @@ -133,7 +133,7 @@ where } /// Variant of [third_partial_derivative] for fallible functions. -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] pub fn try_third_partial_derivative, F, E>( g: G, x: T, @@ -199,7 +199,7 @@ where } /// Variant of [third_partial_derivative_vec] for fallible functions. -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] pub fn try_third_partial_derivative_vec, F, E>( g: G, x: &[T], diff --git a/src/lib.rs b/src/lib.rs index bfd158e..cbd8108 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -40,7 +40,7 @@ //! ``` #![warn(clippy::all)] -#![allow(clippy::needless_range_loop)] +#![warn(clippy::allow_attributes)] use num_traits::{Float, FloatConst, FromPrimitive, Inv, NumAssignOps, NumOps, Signed}; use std::fmt; diff --git a/src/macros.rs b/src/macros.rs index aab4e46..ec1b6fe 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -557,82 +557,66 @@ macro_rules! impl_float_const { $($(DefaultAllocator: Allocator<$dim> + Allocator + Allocator<$dim, $dim>,)* DefaultAllocator: Allocator<$($dim,)*>)? { - #[allow(non_snake_case)] fn E() -> Self { Self::from(F::E()) } - #[allow(non_snake_case)] fn FRAC_1_PI() -> Self { Self::from(F::FRAC_1_PI()) } - #[allow(non_snake_case)] fn FRAC_1_SQRT_2() -> Self { Self::from(F::FRAC_1_SQRT_2()) } - #[allow(non_snake_case)] fn FRAC_2_PI() -> Self { Self::from(F::FRAC_2_PI()) } - #[allow(non_snake_case)] fn FRAC_2_SQRT_PI() -> Self { Self::from(F::FRAC_2_SQRT_PI()) } - #[allow(non_snake_case)] fn FRAC_PI_2() -> Self { Self::from(F::FRAC_PI_2()) } - #[allow(non_snake_case)] fn FRAC_PI_3() -> Self { Self::from(F::FRAC_PI_3()) } - #[allow(non_snake_case)] fn FRAC_PI_4() -> Self { Self::from(F::FRAC_PI_4()) } - #[allow(non_snake_case)] fn FRAC_PI_6() -> Self { Self::from(F::FRAC_PI_6()) } - #[allow(non_snake_case)] fn FRAC_PI_8() -> Self { Self::from(F::FRAC_PI_8()) } - #[allow(non_snake_case)] fn LN_10() -> Self { Self::from(F::LN_10()) } - #[allow(non_snake_case)] fn LN_2() -> Self { Self::from(F::LN_2()) } - #[allow(non_snake_case)] fn LOG10_E() -> Self { Self::from(F::LOG10_E()) } - #[allow(non_snake_case)] fn LOG2_E() -> Self { Self::from(F::LOG2_E()) } - #[allow(non_snake_case)] fn PI() -> Self { Self::from(F::PI()) } - #[allow(non_snake_case)] fn SQRT_2() -> Self { Self::from(F::SQRT_2()) } diff --git a/src/python/hyperdual.rs b/src/python/hyperdual.rs index 67c4eb8..70a148a 100644 --- a/src/python/hyperdual.rs +++ b/src/python/hyperdual.rs @@ -161,7 +161,6 @@ macro_rules! impl_partial_hessian { /// Returns /// ------- /// function value, gradient w.r.t. x, gradient w.r.t. y, and partial Hessian - #[allow(clippy::type_complexity)] pub fn partial_hessian( f: &Bound<'_, PyAny>, x: &Bound<'_, PyAny>, diff --git a/src/python/hyperhyperdual.rs b/src/python/hyperhyperdual.rs index 8a1f9af..8c0fe5e 100644 --- a/src/python/hyperhyperdual.rs +++ b/src/python/hyperhyperdual.rs @@ -9,7 +9,7 @@ use pyo3::prelude::*; pub struct PyHyperHyperDual64(HyperHyperDual64); #[pymethods] -#[allow(clippy::too_many_arguments)] +#[expect(clippy::too_many_arguments)] impl PyHyperHyperDual64 { #[new] fn new( @@ -77,7 +77,7 @@ impl_dual_num!(PyHyperHyperDual64, HyperHyperDual64, f64); /// second partial derivative w.r.t. x and z /// second partial derivative w.r.t. y and z /// third partial derivative -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] pub fn third_partial_derivative( f: &Bound<'_, PyAny>, x: f64, @@ -128,7 +128,7 @@ pub fn third_partial_derivative( /// second partial derivative w.r.t. variables i and k /// second partial derivative w.r.t. variables j and k /// third partial derivative -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] pub fn third_partial_derivative_vec( f: &Bound<'_, PyAny>, x: Vec,