From 0a1fb03757a3ecba86f2f72a514e6b35c9a1896a Mon Sep 17 00:00:00 2001 From: Malik672 Date: Thu, 11 Jan 2024 13:05:00 +0100 Subject: [PATCH] remove redendant code + 0.9.0 --- src/error.rs | 15 +-------------- src/utils/sorted_insert.rs | 4 ++-- src/utils/sqrt.rs | 2 +- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/error.rs b/src/error.rs index b7f9613..749df38 100644 --- a/src/error.rs +++ b/src/error.rs @@ -2,11 +2,6 @@ use crate::prelude::*; #[derive(Debug, Error)] pub enum Error { - #[error("{field} must be greater than 0")] - ChainIdError { field: &'static str }, - - #[error(transparent)] - ParseError(#[from] std::num::ParseIntError), #[error("Chain IDs do not match: {0} and {1}")] ChainIdMismatch(u32, u32), @@ -17,18 +12,10 @@ pub enum Error { #[error("amount has exceeded MAX_UINT256")] MaxUint, - #[error("Error creating: {0}")] - CreationError(String), - - #[error("Can't get the fractional amount: {0}")] - CreateFractionalError(String), - #[error("not equal: {0}")] NotEqual(String), - #[error("Denominator is 0")] - DenominatorIsZero, - + //Custo #[error("incorrect: {0}")] Incorrect(String), } diff --git a/src/utils/sorted_insert.rs b/src/utils/sorted_insert.rs index 7bbb772..4468946 100644 --- a/src/utils/sorted_insert.rs +++ b/src/utils/sorted_insert.rs @@ -9,11 +9,11 @@ pub fn sorted_insert( comparator: fn(&T, &T) -> Ordering, ) -> Result, Error> { if max_size == 0 { - return Err(Error::Incorrect("MAX_SIZE_ZERO".to_owned())); + return Err(Error::Incorrect("max_size can't be equals to zero".to_owned())); } if items.len() > max_size { - return Err(Error::Incorrect("ITEMS_SIZE".to_owned())); + return Err(Error::Incorrect("items_size has to greater than max_size".to_string())); } let removed_item = if items.len() == max_size { diff --git a/src/utils/sqrt.rs b/src/utils/sqrt.rs index da9260b..aa02e20 100644 --- a/src/utils/sqrt.rs +++ b/src/utils/sqrt.rs @@ -10,7 +10,7 @@ use crate::prelude::*; /// pub fn sqrt(value: &BigInt) -> Result { if !value >= Zero::zero() { - return Err(Error::Incorrect("NEGATIVE".to_owned())); + return Err(Error::Incorrect("value has to be greater than -1".to_string())); } // If the value is less than or equal to MAX_SAFE_INTEGER,