mirror of
https://github.com/uutils/coreutils
synced 2024-11-16 17:58:06 +00:00
Fix type-error when calling parse_size
from sort
This commit is contained in:
parent
5d861df961
commit
8535cd41e0
1 changed files with 8 additions and 1 deletions
|
@ -33,6 +33,7 @@ use numeric_str_cmp::{human_numeric_str_cmp, numeric_str_cmp, NumInfo, NumInfoPa
|
||||||
use rand::{thread_rng, Rng};
|
use rand::{thread_rng, Rng};
|
||||||
use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
use std::convert::TryFrom;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::ffi::{OsStr, OsString};
|
use std::ffi::{OsStr, OsString};
|
||||||
|
@ -354,7 +355,13 @@ impl GlobalSettings {
|
||||||
} else if size_string.ends_with('b') {
|
} else if size_string.ends_with('b') {
|
||||||
size_string.pop();
|
size_string.pop();
|
||||||
}
|
}
|
||||||
parse_size(&size_string)
|
let size = parse_size(&size_string)?;
|
||||||
|
usize::try_from(size).map_err(|_| {
|
||||||
|
ParseSizeError::SizeTooBig(format!(
|
||||||
|
"Buffer size {} does not fit in address space",
|
||||||
|
size
|
||||||
|
))
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
Err(ParseSizeError::ParseFailure("invalid suffix".to_string()))
|
Err(ParseSizeError::ParseFailure("invalid suffix".to_string()))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue