option_parser: use an array directly to simplify code

Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
Wei Liu 2024-07-23 19:18:27 +00:00 committed by Rob Bradford
parent a2438700e4
commit 61a5bae25c

View File

@ -205,7 +205,7 @@ impl FromStr for ByteSized {
0
};
let s = s.trim_end_matches(|c| c == 'K' || c == 'M' || c == 'G');
let s = s.trim_end_matches(['K', 'M', 'G']);
s.parse::<u64>()
.map_err(|_| ByteSizedParseError::InvalidValue(s.to_owned()))?
<< shift