mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-23 14:08:31 +00:00
agent: clear match_like_matches_macro/vec_resize_to_zero warnings
This commit fix these warnings for Rust v1.47.0: - match_like_matches_macro - vec_resize_to_zero Signed-off-by: bin liu <bin@hyper.sh> Signed-off-by: Chelsea Mafrica <chelsea.e.mafrica@intel.com>
This commit is contained in:
parent
974e0e3b31
commit
4f9b5fafcc
@ -225,10 +225,9 @@ fn get_bool_value(param: &str) -> Result<bool> {
|
||||
// first try to parse as bool value
|
||||
v.parse::<bool>().or_else(|_err1| {
|
||||
// then try to parse as integer value
|
||||
v.parse::<u64>().or_else(|_err2| Ok(0)).map(|v| match v {
|
||||
0 => false,
|
||||
_ => true,
|
||||
})
|
||||
v.parse::<u64>()
|
||||
.or_else(|_err2| Ok(0))
|
||||
.map(|v| !matches!(v, 0))
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -1399,7 +1399,7 @@ fn read_stream(fd: RawFd, l: usize) -> Result<Vec<u8>> {
|
||||
}
|
||||
Err(e) => match e {
|
||||
nix::Error::Sys(errno) => match errno {
|
||||
Errno::EAGAIN => v.resize(0, 0),
|
||||
Errno::EAGAIN => v.clear(),
|
||||
_ => return Err(anyhow!(nix::Error::Sys(errno))),
|
||||
},
|
||||
_ => return Err(anyhow!("read error")),
|
||||
|
Loading…
Reference in New Issue
Block a user