Skip to content

Commit

Permalink
remove redendant code + 0.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
malik672 committed Jan 11, 2024
1 parent edcdb3f commit 0a1fb03
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
15 changes: 1 addition & 14 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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),
}
4 changes: 2 additions & 2 deletions src/utils/sorted_insert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ pub fn sorted_insert<T: Clone>(
comparator: fn(&T, &T) -> Ordering,
) -> Result<Option<T>, 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 {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/sqrt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::prelude::*;
///
pub fn sqrt(value: &BigInt) -> Result<BigInt, Error> {
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,
Expand Down

0 comments on commit 0a1fb03

Please sign in to comment.