Skip to content

Commit

Permalink
chore: cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
sebcrozet committed Jun 22, 2024
1 parent b0f162a commit 9de79d6
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 40 deletions.
8 changes: 2 additions & 6 deletions src/scalar/complex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,11 +468,7 @@ macro_rules! impl_complex (
)*)
);

#[cfg(all(
not(feature = "std"),
not(feature = "libm_force"),
feature = "libm"
))]
#[cfg(all(not(feature = "std"), not(feature = "libm_force"), feature = "libm"))]
impl_complex!(
f32, f32, Float;
f64, f64, Float
Expand Down Expand Up @@ -1441,7 +1437,7 @@ impl<N: RealField + PartialOrd> ComplexField for num_complex::Complex<N> {
let two = one.clone() + one.clone();
two.clone()
* (((self.clone() + one.clone()) / two.clone()).sqrt() + ((self - one) / two).sqrt())
.ln()
.ln()
}

/// Computes the principal value of inverse hyperbolic tangent of `self`.
Expand Down
20 changes: 10 additions & 10 deletions src/scalar/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ use num::NumAssign;
pub use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssign};

/// Trait __alias__ for `Add` with result of type `Self`.
pub trait ClosedAdd<Right = Self>: Sized + Add<Right, Output=Self> {}
pub trait ClosedAdd<Right = Self>: Sized + Add<Right, Output = Self> {}

/// Trait __alias__ for `Sub` with result of type `Self`.
pub trait ClosedSub<Right = Self>: Sized + Sub<Right, Output=Self> {}
pub trait ClosedSub<Right = Self>: Sized + Sub<Right, Output = Self> {}

/// Trait __alias__ for `Mul` with result of type `Self`.
pub trait ClosedMul<Right = Self>: Sized + Mul<Right, Output=Self> {}
pub trait ClosedMul<Right = Self>: Sized + Mul<Right, Output = Self> {}

/// Trait __alias__ for `Div` with result of type `Self`.
pub trait ClosedDiv<Right = Self>: Sized + Div<Right, Output=Self> {}
pub trait ClosedDiv<Right = Self>: Sized + Div<Right, Output = Self> {}

/// Trait __alias__ for `Neg` with result of type `Self`.
pub trait ClosedNeg: Sized + Neg<Output=Self> {}
pub trait ClosedNeg: Sized + Neg<Output = Self> {}

/// Trait __alias__ for `Add` and `AddAssign` with result of type `Self`.
pub trait ClosedAddAssign<Right = Self>: ClosedAdd<Right> + AddAssign<Right> {}
Expand All @@ -29,15 +29,15 @@ pub trait ClosedMulAssign<Right = Self>: ClosedMul<Right> + MulAssign<Right> {}
/// Trait __alias__ for `Div` and `DivAssign` with result of type `Self`.
pub trait ClosedDivAssign<Right = Self>: ClosedDiv<Right> + DivAssign<Right> {}

impl<T, Right> ClosedAdd<Right> for T where T: Add<Right, Output=T> + AddAssign<Right> {}
impl<T, Right> ClosedAdd<Right> for T where T: Add<Right, Output = T> + AddAssign<Right> {}

impl<T, Right> ClosedSub<Right> for T where T: Sub<Right, Output=T> + SubAssign<Right> {}
impl<T, Right> ClosedSub<Right> for T where T: Sub<Right, Output = T> + SubAssign<Right> {}

impl<T, Right> ClosedMul<Right> for T where T: Mul<Right, Output=T> + MulAssign<Right> {}
impl<T, Right> ClosedMul<Right> for T where T: Mul<Right, Output = T> + MulAssign<Right> {}

impl<T, Right> ClosedDiv<Right> for T where T: Div<Right, Output=T> + DivAssign<Right> {}
impl<T, Right> ClosedDiv<Right> for T where T: Div<Right, Output = T> + DivAssign<Right> {}

impl<T> ClosedNeg for T where T: Neg<Output=T> {}
impl<T> ClosedNeg for T where T: Neg<Output = T> {}

impl<T, Right> ClosedAddAssign<Right> for T where T: ClosedAdd<Right> + AddAssign<Right> {}

Expand Down
16 changes: 6 additions & 10 deletions src/scalar/real.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ use num::Float;
/// Trait shared by all reals.
#[allow(missing_docs)]
pub trait RealField:
ComplexField<RealField=Self>
+ RelativeEq<Epsilon=Self>
+ UlpsEq<Epsilon=Self>
+ Signed
+ PartialOrd
ComplexField<RealField = Self>
+ RelativeEq<Epsilon = Self>
+ UlpsEq<Epsilon = Self>
+ Signed
+ PartialOrd
{
/// Is the sign of this real number positive?
fn is_sign_positive(&self) -> bool;
Expand Down Expand Up @@ -208,11 +208,7 @@ macro_rules! impl_real (
)*)
);

#[cfg(all(
not(feature = "std"),
not(feature = "libm_force"),
feature = "libm"
))]
#[cfg(all(not(feature = "std"), not(feature = "libm_force"), feature = "libm"))]
impl_real!(f32, f32, Float, Float; f64, f64, Float, Float);
#[cfg(all(feature = "std", not(feature = "libm_force")))]
impl_real!(f32, f32, f32, f32; f64, f64, f64, f64);
Expand Down
6 changes: 4 additions & 2 deletions src/simd/portable_simd_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ use std::{
RemAssign, Sub, SubAssign,
},
simd::{
self as portable_simd, num::SimdFloat, num::SimdInt, cmp::SimdOrd, cmp::SimdPartialEq,
cmp::SimdPartialOrd as PortableSimdPartialOrd, num::SimdUint, StdFloat, },
self as portable_simd, cmp::SimdOrd, cmp::SimdPartialEq,
cmp::SimdPartialOrd as PortableSimdPartialOrd, num::SimdFloat, num::SimdInt, num::SimdUint,
StdFloat,
},
};

// This is a hack to allow use to reuse `_0` as integers or as identifier,
Expand Down
22 changes: 11 additions & 11 deletions src/simd/simd_bool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ use std::ops::{BitAnd, BitOr, BitXor, Not};
/// It is designed to abstract the behavior of booleans so it can work with multi-lane boolean
/// values in an AoSoA setting.
pub trait SimdBool:
Copy
+ BitAnd<Self, Output=Self>
+ BitOr<Self, Output=Self>
+ BitXor<Self, Output=Self>
+ Not<Output=Self>
Copy
+ BitAnd<Self, Output = Self>
+ BitOr<Self, Output = Self>
+ BitXor<Self, Output = Self>
+ Not<Output = Self>
{
/// A bit mask representing the boolean state of each lanes of `self`.
///
Expand All @@ -36,7 +36,7 @@ Copy
///
/// The implementor of this trait is free to choose on what cases `if_value` and `else_value` are actually
/// called.
fn if_else<Res: SimdValue<SimdBool=Self>>(
fn if_else<Res: SimdValue<SimdBool = Self>>(
self,
if_value: impl FnOnce() -> Res,
else_value: impl FnOnce() -> Res,
Expand All @@ -49,7 +49,7 @@ Copy
/// - For each lane of `self` containing `0` but with a corresponding lane of `else_if.0()` containing `0`, the result will contain the corresponding lane of `else_value()`.
///
/// The implementor of this trait is free to choose on what cases any of those closures are implemented.
fn if_else2<Res: SimdValue<SimdBool=Self>>(
fn if_else2<Res: SimdValue<SimdBool = Self>>(
self,
if_value: impl FnOnce() -> Res,
else_if: (impl FnOnce() -> Self, impl FnOnce() -> Res),
Expand All @@ -64,7 +64,7 @@ Copy
/// - Other lanes will contain the corresponding lane of `else_value()`.
///
/// The implementor of this trait is free to choose on what cases any of those closures are implemented.
fn if_else3<Res: SimdValue<SimdBool=Self>>(
fn if_else3<Res: SimdValue<SimdBool = Self>>(
self,
if_value: impl FnOnce() -> Res,
else_if: (impl FnOnce() -> Self, impl FnOnce() -> Res),
Expand Down Expand Up @@ -110,7 +110,7 @@ impl SimdBool for bool {
}

#[inline(always)]
fn if_else<Res: SimdValue<SimdBool=Self>>(
fn if_else<Res: SimdValue<SimdBool = Self>>(
self,
if_value: impl FnOnce() -> Res,
else_value: impl FnOnce() -> Res,
Expand All @@ -123,7 +123,7 @@ impl SimdBool for bool {
}

#[inline(always)]
fn if_else2<Res: SimdValue<SimdBool=Self>>(
fn if_else2<Res: SimdValue<SimdBool = Self>>(
self,
if_value: impl FnOnce() -> Res,
else_if: (impl FnOnce() -> Self, impl FnOnce() -> Res),
Expand All @@ -139,7 +139,7 @@ impl SimdBool for bool {
}

#[inline(always)]
fn if_else3<Res: SimdValue<SimdBool=Self>>(
fn if_else3<Res: SimdValue<SimdBool = Self>>(
self,
if_value: impl FnOnce() -> Res,
else_if: (impl FnOnce() -> Self, impl FnOnce() -> Res),
Expand Down
2 changes: 1 addition & 1 deletion src/simd/simd_real.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::simd::{SimdComplexField, SimdPartialOrd, SimdSigned};
/// This is implemented by scalar reals like `f32` and `f64` as well as SIMD reals like `portable_simd::f32x4`.
#[allow(missing_docs)]
pub trait SimdRealField:
SimdPartialOrd + SimdSigned + SimdComplexField<SimdRealField=Self>
SimdPartialOrd + SimdSigned + SimdComplexField<SimdRealField = Self>
{
/// Copies the sign of `sign` to `self`.
///
Expand Down

0 comments on commit 9de79d6

Please sign in to comment.