From 6db30d30e21dc599d8475a9bea8cc0b8279a40db Mon Sep 17 00:00:00 2001 From: Jonathan Cornaz Date: Sun, 9 Jul 2023 20:41:10 +0200 Subject: [PATCH] Revert "start implementing `PartialOrd` for `Directive`" This reverts commit d220cec6d2691e80e86a5d40be3c8ee0266f10df. --- CHANGELOG.md | 1 - src/lib.rs | 10 ---------- tests/util_spec.rs | 13 ------------- 3 files changed, 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 66729fe..72d7c6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). * Support booking method in open account directive * implement `std::error::Error` for `ConversionError` * implement `FromStr` for `Directive` where `D: Decimal` -* implement `PartialOrd` for `Directive` ## [2.0.0-beta.2] - 2023-07-08 diff --git a/src/lib.rs b/src/lib.rs index a453c02..704ee44 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -43,7 +43,6 @@ //! # Ok(()) } //! ``` -use std::cmp::Ordering; use std::{collections::HashSet, fs::File, io::Read, path::PathBuf, str::FromStr}; use nom::{ @@ -293,15 +292,6 @@ impl FromStr for Directive { } } -impl PartialOrd for Directive -where - Directive: PartialEq, -{ - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.date.cmp(&other.date)) - } -} - /// Directive specific content #[allow(missing_docs)] #[derive(Debug, Clone, PartialEq)] diff --git a/tests/util_spec.rs b/tests/util_spec.rs index ff3a0ba..12c95d8 100644 --- a/tests/util_spec.rs +++ b/tests/util_spec.rs @@ -94,16 +94,3 @@ fn directive_from_str( let from_str: Directive = input.parse().unwrap(); assert_eq!(from_file, from_str); } - -#[rstest] -#[case("2023-07-09 open Assets:Cash", "2023-07-10 open Assets:Cash")] -#[case("2023-07-09 open Assets:Cash", "2023-08-08 open Assets:Cash")] -#[case("2023-07-09 open Assets:Cash", "2024-06-08 open Assets:Cash")] -fn directive_ord(#[case] smaller: Directive, #[case] bigger: Directive) { - assert!(smaller < bigger); - assert!(smaller <= bigger); - assert_eq!(smaller, smaller.clone()); - assert_eq!(bigger, bigger.clone()); - assert!(bigger > smaller); - assert!(bigger >= smaller); -}