From 11ee89ba57b24cbf3cd6fc8ef31ef840a84756d7 Mon Sep 17 00:00:00 2001 From: Paul Butler Date: Mon, 25 Dec 2023 22:12:30 -0400 Subject: [PATCH] clippy --- src/fract_index.rs | 6 +++--- src/stringify.rs | 40 +++++++++++++++++++--------------------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/src/fract_index.rs b/src/fract_index.rs index 3b1ed49..6aa4093 100644 --- a/src/fract_index.rs +++ b/src/fract_index.rs @@ -179,9 +179,9 @@ impl FractionalIndex { upper_bound: Option<&FractionalIndex>, ) -> Option { match (lower_bound, upper_bound) { - (Some(lower), Some(upper)) => FractionalIndex::new_between(&lower, &upper), - (Some(lower), None) => Some(FractionalIndex::new_after(&lower)), - (None, Some(upper)) => Some(FractionalIndex::new_before(&upper)), + (Some(lower), Some(upper)) => FractionalIndex::new_between(lower, upper), + (Some(lower), None) => Some(FractionalIndex::new_after(lower)), + (None, Some(upper)) => Some(FractionalIndex::new_before(upper)), (None, None) => FractionalIndex::default().into(), } } diff --git a/src/stringify.rs b/src/stringify.rs index 2e7180f..96a335f 100644 --- a/src/stringify.rs +++ b/src/stringify.rs @@ -17,27 +17,25 @@ //! c: FractionalIndex, //! } //! -//! fn main() { -//! let a = FractionalIndex::default(); -//! let b = FractionalIndex::new_after(&a); -//! let c = FractionalIndex::new_between(&a, &b).unwrap(); -//! -//! let my_struct = MyStruct { -//! a: a.clone(), -//! b: b.clone(), -//! c: c.clone(), -//! }; -//! -//! let json_value = serde_json::to_value(&my_struct).unwrap(); -//! -//! let expected = json!({ -//! "a": "80", -//! "b": "8180", -//! "c": "817f80", -//! }); -//! -//! assert_eq!(expected, json_value); -//! } +//! let a = FractionalIndex::default(); +//! let b = FractionalIndex::new_after(&a); +//! let c = FractionalIndex::new_between(&a, &b).unwrap(); +//! +//! let my_struct = MyStruct { +//! a: a.clone(), +//! b: b.clone(), +//! c: c.clone(), +//! }; +//! +//! let json_value = serde_json::to_value(&my_struct).unwrap(); +//! +//! let expected = json!({ +//! "a": "80", +//! "b": "8180", +//! "c": "817f80", +//! }); +//! +//! assert_eq!(expected, json_value); //! ``` use crate::FractionalIndex; use serde::{Deserialize, Deserializer, Serializer};