runtime-rs: Fix useless-vec warning

Fix clippy::useless-vec warning

Fixes: #7902
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
This commit is contained in:
stevenhorsman 2023-09-11 18:09:54 +01:00
parent 99f3d69e94
commit 1d8b78959d
4 changed files with 5 additions and 5 deletions

View File

@ -148,7 +148,7 @@ mod tests {
#[test] #[test]
fn test_parse_ip_cidr() { fn test_parse_ip_cidr() {
let test_cases = vec![ let test_cases = [
("127.0.0.1/32", ("127.0.0.1", 32u8)), ("127.0.0.1/32", ("127.0.0.1", 32u8)),
("2001:4860:4860::8888/32", ("2001:4860:4860::8888", 32u8)), ("2001:4860:4860::8888/32", ("2001:4860:4860::8888", 32u8)),
("2001:4860:4860::8888/128", ("2001:4860:4860::8888", 128u8)), ("2001:4860:4860::8888/128", ("2001:4860:4860::8888", 128u8)),
@ -158,7 +158,7 @@ mod tests {
assert_eq!(ipaddr.to_string(), tc.1 .0); assert_eq!(ipaddr.to_string(), tc.1 .0);
assert_eq!(mask, tc.1 .1); assert_eq!(mask, tc.1 .1);
} }
let test_cases = vec![ let test_cases = [
"127.0.0.1/33", "127.0.0.1/33",
"2001:4860:4860::8888/129", "2001:4860:4860::8888/129",
"2001:4860:4860::8888/300", "2001:4860:4860::8888/300",

View File

@ -181,7 +181,7 @@ impl Volume for BlockVolume {
} }
pub(crate) fn is_block_volume(m: &oci::Mount) -> Result<bool> { pub(crate) fn is_block_volume(m: &oci::Mount) -> Result<bool> {
let vol_types = vec![KATA_MOUNT_BIND_TYPE, KATA_DIRECT_VOLUME_TYPE]; let vol_types = [KATA_MOUNT_BIND_TYPE, KATA_DIRECT_VOLUME_TYPE];
if !vol_types.contains(&m.r#type.as_str()) { if !vol_types.contains(&m.r#type.as_str()) {
return Ok(false); return Ok(false);
} }

View File

@ -68,7 +68,7 @@ impl ShmVolume {
r#type: "tmpfs".to_string(), r#type: "tmpfs".to_string(),
destination: m.destination.clone(), destination: m.destination.clone(),
source: "shm".to_string(), source: "shm".to_string(),
options: vec![ options: [
"noexec", "noexec",
"nosuid", "nosuid",
"nodev", "nodev",

View File

@ -183,7 +183,7 @@ impl Volume for SPDKVolume {
pub(crate) fn is_spdk_volume(m: &oci::Mount) -> bool { pub(crate) fn is_spdk_volume(m: &oci::Mount) -> bool {
// spdkvol or spoolvol will share the same implementation // spdkvol or spoolvol will share the same implementation
let vol_types = vec![KATA_SPDK_VOLUME_TYPE, KATA_SPOOL_VOLUME_TYPE]; let vol_types = [KATA_SPDK_VOLUME_TYPE, KATA_SPOOL_VOLUME_TYPE];
if vol_types.contains(&m.r#type.as_str()) { if vol_types.contains(&m.r#type.as_str()) {
return true; return true;
} }