Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
chore: fixed fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
akorchyn committed Sep 9, 2024
1 parent c7889dc commit 0158410
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/common/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ use crate::errors::DecimalNumberParsingError;
/// If the string slice has invalid chars, it will return the error `DecimalNumberParsingError::InvalidNumber`.
///
/// If the whole part of the number has a value more than the `u64` maximum value, it will return the error `DecimalNumberParsingError::LongWhole`.
pub fn parse_decimal_number(
s: &str,
pref_const: u128,
) -> Result<u128, DecimalNumberParsingError> {
pub fn parse_decimal_number(s: &str, pref_const: u128) -> Result<u128, DecimalNumberParsingError> {
let (int, fract) = if let Some((whole, fractional)) = s.trim().split_once('.') {
let int: u128 = whole
.parse()
Expand Down Expand Up @@ -65,7 +62,11 @@ mod tests {
),
(129_380_000_001_u128, "0.129380000001", 10u128.pow(12)),
(129_380_000_001_000_u128, "129.380000001000", 10u128.pow(12)),
(9_488_129_380_000_001_u128, "9488.129380000001", 10u128.pow(12)),
(
9_488_129_380_000_001_u128,
"9488.129380000001",
10u128.pow(12),
),
(129_380_000_001_u128, "00.129380000001", 10u128.pow(12)),
];

Expand Down

0 comments on commit 0158410

Please sign in to comment.