Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
lthiery committed Oct 26, 2020
1 parent 244d1ce commit 5cfa933
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/cmd/oracle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,19 +191,15 @@ use rand_distr::{Distribution, Normal};

fn price_has_changed_enough(old_price: &Price, new_price: &Price, change: f32) -> bool {
// copy and scale old price for Upper Bound
let mut old_price_ub = old_price.clone();
let mut old_price_ub = *old_price;
old_price_ub.scale(1.0 + change / 100.0);

// copy and scale new price for Lower Bound
let mut old_price_lb = old_price.clone();
let mut old_price_lb = *old_price;
old_price_lb.scale(1.0 - change / 100.0);

// compare bounds to new price
if &old_price_ub < new_price || &old_price_lb > new_price {
true
} else {
false
}
&old_price_ub < new_price || &old_price_lb > new_price
}

impl AutomatedReportByWeightedAverage {
Expand Down

0 comments on commit 5cfa933

Please sign in to comment.