1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 12:07:46 +00:00

seq: Simplify leading + handling

Address review comment.
This commit is contained in:
Nicolas Boichat 2025-04-03 12:28:49 +02:00 committed by Daniel Hofstetter
parent 27efb9eff4
commit 04a12820bb

View file

@ -27,12 +27,9 @@ pub enum ParseNumberError {
// need to be too careful. // need to be too careful.
fn compute_num_digits(input: &str, ebd: ExtendedBigDecimal) -> PreciseNumber { fn compute_num_digits(input: &str, ebd: ExtendedBigDecimal) -> PreciseNumber {
let input = input.to_lowercase(); let input = input.to_lowercase();
let mut input = input.trim_start();
// Leading + is ignored for this. // Leading + is ignored for this.
if let Some(trimmed) = input.strip_prefix('+') { let input = input.trim_start().strip_prefix('+').unwrap_or(&input);
input = trimmed;
}
// Integral digits for any hex number is ill-defined (0 is fine as an output) // Integral digits for any hex number is ill-defined (0 is fine as an output)
// Fractional digits for an floating hex number is ill-defined, return None // Fractional digits for an floating hex number is ill-defined, return None