Skip to content

Commit

Permalink
Delete unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmostellar committed May 15, 2024
1 parent 3865705 commit 3d8f2a2
Showing 1 changed file with 2 additions and 25 deletions.
27 changes: 2 additions & 25 deletions wasm/src/tools/formatting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,19 +164,6 @@ pub fn parse_string_to_usize(
) -> Result<usize, Box<dyn Error>> {
use crate::utils::{get_locale_string, LocaleCategory};

if let Some(input) = input {
if input.is_empty() {
// This part of the code is possibly unreachable.
let msg = get_locale_string(
locales,
LocaleCategory::Formatting,
"Failed to read options. Please make sure there is no option with an empty value.",
);

return Err(msg.into());
}
}

match input {
Some(input) => match input.parse::<usize>() {
Ok(num) => Ok(num),
Expand All @@ -189,19 +176,9 @@ pub fn parse_string_to_usize(
"Failed to read options. Some of them are possibly not positive number values.",
);

#[allow(clippy::needless_return)]
return Err(msg.into());
Err(msg.into())
}
},
None => {
let msg = get_locale_string(
locales,
LocaleCategory::Formatting,
"Failed to read option properties.",
);

#[allow(clippy::needless_return)]
return Err(msg.into());
}
None => unreachable!(),
}
}

0 comments on commit 3d8f2a2

Please sign in to comment.