Skip to content

Commit

Permalink
FMT & Autofix
Browse files Browse the repository at this point in the history
  • Loading branch information
CI committed May 24, 2022
1 parent 3507a1d commit 1074883
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion mady_macro_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ pub fn new() -> Parser {
Parser::new()
.register(Linker::new())
.register(Folder::new())
}
}
22 changes: 16 additions & 6 deletions mady_math/src/grad.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,10 @@ mod impl_max {
type Output = Self;
type GradLeft = Self;
type GradRight = Self;
fn grad_max(self: Self, i: Self) -> (Self::Output, (Self::GradLeft, Self::GradRight)) {
fn grad_max(
self: Self,
i: Self,
) -> (Self::Output, (Self::GradLeft, Self::GradRight)) {
match self.cmp(&i) {
Ordering::Less | Ordering::Equal => (i, (Self::zero(), Self::one())),
Ordering::Greater => (self, (Self::one(), Self::zero())),
Expand All @@ -191,7 +194,10 @@ mod impl_max {
type Output = Self;
type GradLeft = Self;
type GradRight = Self;
fn grad_max(self: Self, i: Self) -> (Self::Output, (Self::GradLeft, Self::GradRight)) {
fn grad_max(
self: Self,
i: Self,
) -> (Self::Output, (Self::GradLeft, Self::GradRight)) {
match self.partial_cmp(&i).unwrap() {
Ordering::Less | Ordering::Equal => (i, (Self::zero(), Self::one())),
Ordering::Greater => (self, (Self::one(), Self::zero())),
Expand All @@ -215,7 +221,10 @@ mod impl_min {
type Output = Self;
type GradLeft = Self;
type GradRight = Self;
fn grad_min(self: Self, i: Self) -> (Self::Output, (Self::GradLeft, Self::GradRight)) {
fn grad_min(
self: Self,
i: Self,
) -> (Self::Output, (Self::GradLeft, Self::GradRight)) {
match self.partial_cmp(&i).unwrap() {
Ordering::Less | Ordering::Equal => (self, (Self::one(), Self::zero())),
Ordering::Greater => (i, (Self::zero(), Self::one())),
Expand All @@ -233,7 +242,10 @@ mod impl_min {
type Output = Self;
type GradLeft = Self;
type GradRight = Self;
fn grad_min(self: Self, i: Self) -> (Self::Output, (Self::GradLeft, Self::GradRight)) {
fn grad_min(
self: Self,
i: Self,
) -> (Self::Output, (Self::GradLeft, Self::GradRight)) {
match self.partial_cmp(&i).unwrap() {
Ordering::Less | Ordering::Equal => (self, (Self::one(), Self::zero())),
Ordering::Greater => (i, (Self::zero(), Self::one())),
Expand Down Expand Up @@ -325,7 +337,6 @@ mod impl_div {
impl_trait![parse, i8, i16, i32, i64, i128, isize, f32, f64];
}


// impl_trait![
// GradPow,
// fn grad_pow(self, i: u32) -> (Self, (Self,)) {
Expand Down Expand Up @@ -382,7 +393,6 @@ mod impl_div {
// f64
// ];


#[cfg(test)]
mod tests {
use super::*;
Expand Down

0 comments on commit 1074883

Please sign in to comment.