mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 05:35:20 +00:00
option_parser: use an array directly to simplify code
Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
parent
a2438700e4
commit
61a5bae25c
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user