Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgb committed Dec 26, 2023
1 parent 1fe1fa2 commit 11ee89b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 24 deletions.
6 changes: 3 additions & 3 deletions src/fract_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ impl FractionalIndex {
upper_bound: Option<&FractionalIndex>,
) -> Option<FractionalIndex> {
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(),
}
}
Expand Down
40 changes: 19 additions & 21 deletions src/stringify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down

0 comments on commit 11ee89b

Please sign in to comment.