Skip to content

Commit db52777

Browse files
authored
Replace #[allow(...)] with #[expect(...)] (#77)
* replace allow with expect * add rust version requirement
1 parent f4123e3 commit db52777

10 files changed

+13
-29
lines changed

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name = "num-dual"
33
version = "0.9.1"
44
authors = ["Gernot Bauer <[email protected]>",
55
"Philipp Rehner <[email protected]>"]
6+
rust-version = "1.81"
67
edition = "2021"
78
readme = "README.md"
89
license = "MIT OR Apache-2.0"

src/derivative.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ where
140140
}
141141

142142
impl<T: DualNum<F>, F> Derivative<T, F, U1, U1> {
143-
#[allow(clippy::self_named_constructors)]
143+
#[expect(clippy::self_named_constructors)]
144144
pub fn derivative() -> Self {
145145
Self::some(SVector::identity())
146146
}

src/dual2_vec.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ where
8989
}
9090

9191
/// Variant of [hessian] for fallible functions.
92-
#[allow(clippy::type_complexity)]
92+
#[expect(clippy::type_complexity)]
9393
pub fn try_hessian<G, T: DualNum<F>, F: DualNumFloat, E, D: Dim>(
9494
g: G,
9595
x: OVector<T, D>,

src/dual_vec.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ where
146146
}
147147

148148
/// Variant of [jacobian] for fallible functions.
149-
#[allow(clippy::type_complexity)]
149+
#[expect(clippy::type_complexity)]
150150
pub fn try_jacobian<G, T: DualNum<F>, F: DualNumFloat, E, M: Dim, N: Dim>(
151151
g: G,
152152
x: OVector<T, N>,

src/hyperdual_vec.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ where
9696
/// assert_relative_eq!(d2fdxdy[0], -0.032);
9797
/// assert_relative_eq!(d2fdxdy[1], -0.024);
9898
/// ```
99-
#[allow(clippy::type_complexity)]
99+
#[expect(clippy::type_complexity)]
100100
pub fn partial_hessian<G, T: DualNum<F>, F: DualNumFloat, M: Dim, N: Dim>(
101101
g: G,
102102
x: OVector<T, M>,
@@ -113,7 +113,7 @@ where
113113
}
114114

115115
/// Variant of [partial_hessian] for fallible functions.
116-
#[allow(clippy::type_complexity)]
116+
#[expect(clippy::type_complexity)]
117117
pub fn try_partial_hessian<G, T: DualNum<F>, F: DualNumFloat, E, M: Dim, N: Dim>(
118118
g: G,
119119
x: OVector<T, M>,

src/hyperhyperdual.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub type HyperHyperDual64 = HyperHyperDual<f64>;
3838
impl<T: DualNum<F>, F> HyperHyperDual<T, F> {
3939
/// Create a new hyper-hyper-dual number from its fields.
4040
#[inline]
41-
#[allow(clippy::too_many_arguments)]
41+
#[expect(clippy::too_many_arguments)]
4242
pub fn new(
4343
re: T,
4444
eps1: T,
@@ -133,7 +133,7 @@ where
133133
}
134134

135135
/// Variant of [third_partial_derivative] for fallible functions.
136-
#[allow(clippy::type_complexity)]
136+
#[expect(clippy::type_complexity)]
137137
pub fn try_third_partial_derivative<G, T: DualNum<F>, F, E>(
138138
g: G,
139139
x: T,
@@ -199,7 +199,7 @@ where
199199
}
200200

201201
/// Variant of [third_partial_derivative_vec] for fallible functions.
202-
#[allow(clippy::type_complexity)]
202+
#[expect(clippy::type_complexity)]
203203
pub fn try_third_partial_derivative_vec<G, T: DualNum<F>, F, E>(
204204
g: G,
205205
x: &[T],

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
//! ```
4141
4242
#![warn(clippy::all)]
43-
#![allow(clippy::needless_range_loop)]
43+
#![warn(clippy::allow_attributes)]
4444

4545
use num_traits::{Float, FloatConst, FromPrimitive, Inv, NumAssignOps, NumOps, Signed};
4646
use std::fmt;

src/macros.rs

-16
Original file line numberDiff line numberDiff line change
@@ -557,82 +557,66 @@ macro_rules! impl_float_const {
557557
$($(DefaultAllocator: Allocator<$dim> + Allocator<U1, $dim> + Allocator<$dim, $dim>,)*
558558
DefaultAllocator: Allocator<$($dim,)*>)?
559559
{
560-
#[allow(non_snake_case)]
561560
fn E() -> Self {
562561
Self::from(F::E())
563562
}
564563

565-
#[allow(non_snake_case)]
566564
fn FRAC_1_PI() -> Self {
567565
Self::from(F::FRAC_1_PI())
568566
}
569567

570-
#[allow(non_snake_case)]
571568
fn FRAC_1_SQRT_2() -> Self {
572569
Self::from(F::FRAC_1_SQRT_2())
573570
}
574571

575-
#[allow(non_snake_case)]
576572
fn FRAC_2_PI() -> Self {
577573
Self::from(F::FRAC_2_PI())
578574
}
579575

580-
#[allow(non_snake_case)]
581576
fn FRAC_2_SQRT_PI() -> Self {
582577
Self::from(F::FRAC_2_SQRT_PI())
583578
}
584579

585-
#[allow(non_snake_case)]
586580
fn FRAC_PI_2() -> Self {
587581
Self::from(F::FRAC_PI_2())
588582
}
589583

590-
#[allow(non_snake_case)]
591584
fn FRAC_PI_3() -> Self {
592585
Self::from(F::FRAC_PI_3())
593586
}
594587

595-
#[allow(non_snake_case)]
596588
fn FRAC_PI_4() -> Self {
597589
Self::from(F::FRAC_PI_4())
598590
}
599591

600-
#[allow(non_snake_case)]
601592
fn FRAC_PI_6() -> Self {
602593
Self::from(F::FRAC_PI_6())
603594
}
604595

605-
#[allow(non_snake_case)]
606596
fn FRAC_PI_8() -> Self {
607597
Self::from(F::FRAC_PI_8())
608598
}
609599

610-
#[allow(non_snake_case)]
611600
fn LN_10() -> Self {
612601
Self::from(F::LN_10())
613602
}
614603

615-
#[allow(non_snake_case)]
616604
fn LN_2() -> Self {
617605
Self::from(F::LN_2())
618606
}
619607

620-
#[allow(non_snake_case)]
621608
fn LOG10_E() -> Self {
622609
Self::from(F::LOG10_E())
623610
}
624611

625-
#[allow(non_snake_case)]
626612
fn LOG2_E() -> Self {
627613
Self::from(F::LOG2_E())
628614
}
629615

630-
#[allow(non_snake_case)]
631616
fn PI() -> Self {
632617
Self::from(F::PI())
633618
}
634619

635-
#[allow(non_snake_case)]
636620
fn SQRT_2() -> Self {
637621
Self::from(F::SQRT_2())
638622
}

src/python/hyperdual.rs

-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ macro_rules! impl_partial_hessian {
161161
/// Returns
162162
/// -------
163163
/// function value, gradient w.r.t. x, gradient w.r.t. y, and partial Hessian
164-
#[allow(clippy::type_complexity)]
165164
pub fn partial_hessian(
166165
f: &Bound<'_, PyAny>,
167166
x: &Bound<'_, PyAny>,

src/python/hyperhyperdual.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use pyo3::prelude::*;
99
pub struct PyHyperHyperDual64(HyperHyperDual64);
1010

1111
#[pymethods]
12-
#[allow(clippy::too_many_arguments)]
12+
#[expect(clippy::too_many_arguments)]
1313
impl PyHyperHyperDual64 {
1414
#[new]
1515
fn new(
@@ -77,7 +77,7 @@ impl_dual_num!(PyHyperHyperDual64, HyperHyperDual64, f64);
7777
/// second partial derivative w.r.t. x and z
7878
/// second partial derivative w.r.t. y and z
7979
/// third partial derivative
80-
#[allow(clippy::type_complexity)]
80+
#[expect(clippy::type_complexity)]
8181
pub fn third_partial_derivative(
8282
f: &Bound<'_, PyAny>,
8383
x: f64,
@@ -128,7 +128,7 @@ pub fn third_partial_derivative(
128128
/// second partial derivative w.r.t. variables i and k
129129
/// second partial derivative w.r.t. variables j and k
130130
/// third partial derivative
131-
#[allow(clippy::type_complexity)]
131+
#[expect(clippy::type_complexity)]
132132
pub fn third_partial_derivative_vec(
133133
f: &Bound<'_, PyAny>,
134134
x: Vec<f64>,

0 commit comments

Comments
 (0)