Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace #[allow(...)] with #[expect(...)] #77

Merged
merged 2 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name = "num-dual"
version = "0.9.1"
authors = ["Gernot Bauer <bauer@itt.uni-stuttgart.de>",
"Philipp Rehner <prehner@ethz.ch>"]
rust-version = "1.81"
edition = "2021"
readme = "README.md"
license = "MIT OR Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/derivative.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ where
}

impl<T: DualNum<F>, F> Derivative<T, F, U1, U1> {
#[allow(clippy::self_named_constructors)]
#[expect(clippy::self_named_constructors)]
pub fn derivative() -> Self {
Self::some(SVector::identity())
}
Expand Down
2 changes: 1 addition & 1 deletion src/dual2_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ where
}

/// Variant of [hessian] for fallible functions.
#[allow(clippy::type_complexity)]
#[expect(clippy::type_complexity)]
pub fn try_hessian<G, T: DualNum<F>, F: DualNumFloat, E, D: Dim>(
g: G,
x: OVector<T, D>,
Expand Down
2 changes: 1 addition & 1 deletion src/dual_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ where
}

/// Variant of [jacobian] for fallible functions.
#[allow(clippy::type_complexity)]
#[expect(clippy::type_complexity)]
pub fn try_jacobian<G, T: DualNum<F>, F: DualNumFloat, E, M: Dim, N: Dim>(
g: G,
x: OVector<T, N>,
Expand Down
4 changes: 2 additions & 2 deletions src/hyperdual_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<G, T: DualNum<F>, F: DualNumFloat, M: Dim, N: Dim>(
g: G,
x: OVector<T, M>,
Expand All @@ -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<G, T: DualNum<F>, F: DualNumFloat, E, M: Dim, N: Dim>(
g: G,
x: OVector<T, M>,
Expand Down
6 changes: 3 additions & 3 deletions src/hyperhyperdual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub type HyperHyperDual64 = HyperHyperDual<f64>;
impl<T: DualNum<F>, F> HyperHyperDual<T, F> {
/// 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,
Expand Down Expand Up @@ -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<G, T: DualNum<F>, F, E>(
g: G,
x: T,
Expand Down Expand Up @@ -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<G, T: DualNum<F>, F, E>(
g: G,
x: &[T],
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 0 additions & 16 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,82 +557,66 @@ macro_rules! impl_float_const {
$($(DefaultAllocator: Allocator<$dim> + Allocator<U1, $dim> + 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())
}
Expand Down
1 change: 0 additions & 1 deletion src/python/hyperdual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand Down
6 changes: 3 additions & 3 deletions src/python/hyperhyperdual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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<f64>,
Expand Down
Loading