Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
m5l14i11 committed Jul 14, 2023
1 parent ebf52ec commit d22c204
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ta_lib/core/src/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl Series<f64> {
}

pub fn neg(&self) -> Series<f64> {
self.fmap(|val| val.map(|v| if *v == 0.0 { *v } else { -*v }))
self.fmap(|val| val.map(|v| v.neg()))
}
}

Expand Down
4 changes: 1 addition & 3 deletions ta_lib/core/src/series.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,9 @@ impl Series<f64> {
}

pub fn nz(&self, replacement: Option<f64>) -> Self {
let replacement = replacement.unwrap_or(0.0);

self.fmap(|opt| match opt {
Some(v) => Some(*v),
None => Some(replacement),
None => Some(replacement.unwrap_or(0.0)),
})
}

Expand Down

0 comments on commit d22c204

Please sign in to comment.