]> Untitled Git - bdk/commitdiff
Use contains combinator
authorTobin Harding <me@tobin.cc>
Mon, 18 Jan 2021 08:28:18 +0000 (19:28 +1100)
committerSteve Myers <steve@notmandatory.org>
Mon, 18 Jan 2021 19:39:37 +0000 (11:39 -0800)
As suggested by clippy, use the `contains` combinator instead of doing
manual range check on floats.

src/blockchain/mod.rs

index 665388160a082636f690e2fad60dafc74b8da617..25c6055b9ff471c2dd85275ffe281e8ba13e85a5 100644 (file)
@@ -169,7 +169,7 @@ pub fn progress() -> (Sender<ProgressData>, Receiver<ProgressData>) {
 
 impl Progress for Sender<ProgressData> {
     fn update(&self, progress: f32, message: Option<String>) -> Result<(), Error> {
-        if progress < 0.0 || progress > 100.0 {
+        if !(0.0..=100.0).contains(&progress) {
             return Err(Error::InvalidProgressValue(progress));
         }