diff --git a/src/agent/src/config.rs b/src/agent/src/config.rs index b503dc8491..36bdf66c86 100644 --- a/src/agent/src/config.rs +++ b/src/agent/src/config.rs @@ -195,6 +195,7 @@ impl FromStr for AgentConfig { impl AgentConfig { #[instrument] + #[allow(clippy::redundant_closure_call)] pub fn from_cmdline(file: &str, args: Vec) -> Result { // If config file specified in the args, generate our config from it let config_position = args.iter().position(|a| a == "--config" || a == "-c"); @@ -1392,7 +1393,7 @@ Caused by: assert_eq!(config.server_addr, "vsock://8:2048"); assert_eq!( config.endpoints.allowed, - vec!["CreateContainer".to_string(), "StartContainer".to_string()] + ["CreateContainer".to_string(), "StartContainer".to_string()] .iter() .cloned() .collect() diff --git a/src/dragonball/src/dbs_utils/src/net/net_gen/mod.rs b/src/dragonball/src/dbs_utils/src/net/net_gen/mod.rs index 30758f3514..ba0f62c13a 100644 --- a/src/dragonball/src/dbs_utils/src/net/net_gen/mod.rs +++ b/src/dragonball/src/dbs_utils/src/net/net_gen/mod.rs @@ -10,6 +10,7 @@ #![allow(non_snake_case)] #![allow(missing_docs)] #![allow(deref_nullptr)] +#![allow(ambiguous_glob_reexports)] // generated with bindgen /usr/include/linux/if.h --no-unstable-rust // --constified-enum '*' --with-derive-default -- -D __UAPI_DEF_IF_IFNAMSIZ -D diff --git a/src/dragonball/src/vcpu/vcpu_manager.rs b/src/dragonball/src/vcpu/vcpu_manager.rs index 41200d0107..dff3aefc3b 100644 --- a/src/dragonball/src/vcpu/vcpu_manager.rs +++ b/src/dragonball/src/vcpu/vcpu_manager.rs @@ -832,7 +832,7 @@ mod hotplug { #[cfg(all(target_arch = "x86_64", feature = "dbs-upcall"))] use dbs_boot::mptable::APIC_VERSION; - #[cfg(all(target_arch = "aarch64"))] + #[cfg(target_arch = "aarch64")] const APIC_VERSION: u8 = 0; #[cfg(feature = "dbs-upcall")] diff --git a/src/libs/safe-path/src/scoped_path_resolver.rs b/src/libs/safe-path/src/scoped_path_resolver.rs index 4d06f00627..d9815f5296 100644 --- a/src/libs/safe-path/src/scoped_path_resolver.rs +++ b/src/libs/safe-path/src/scoped_path_resolver.rs @@ -245,7 +245,7 @@ mod tests { fn test_scoped_resolve_invalid() { scoped_resolve("./root_is_not_absolute_path", ".").unwrap_err(); scoped_resolve("C:", ".").unwrap_err(); - scoped_resolve(r#"\\server\test"#, ".").unwrap_err(); + scoped_resolve(r"\\server\test", ".").unwrap_err(); scoped_resolve(r#"http://localhost/test"#, ".").unwrap_err(); // Chinese Unicode characters scoped_resolve(r#"您好"#, ".").unwrap_err(); diff --git a/src/runtime-rs/crates/resource/src/network/utils/address.rs b/src/runtime-rs/crates/resource/src/network/utils/address.rs index 792c4fbb5f..a9a4c75002 100644 --- a/src/runtime-rs/crates/resource/src/network/utils/address.rs +++ b/src/runtime-rs/crates/resource/src/network/utils/address.rs @@ -148,7 +148,7 @@ mod tests { #[test] fn test_parse_ip_cidr() { - let test_cases = vec![ + let test_cases = [ ("127.0.0.1/32", ("127.0.0.1", 32u8)), ("2001:4860:4860::8888/32", ("2001:4860:4860::8888", 32u8)), ("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!(mask, tc.1 .1); } - let test_cases = vec![ + let test_cases = [ "127.0.0.1/33", "2001:4860:4860::8888/129", "2001:4860:4860::8888/300", diff --git a/src/runtime-rs/crates/resource/src/volume/block_volume.rs b/src/runtime-rs/crates/resource/src/volume/block_volume.rs index ded162bd08..d0e361b243 100644 --- a/src/runtime-rs/crates/resource/src/volume/block_volume.rs +++ b/src/runtime-rs/crates/resource/src/volume/block_volume.rs @@ -181,7 +181,7 @@ impl Volume for BlockVolume { } pub(crate) fn is_block_volume(m: &oci::Mount) -> Result { - 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()) { return Ok(false); } diff --git a/src/runtime-rs/crates/resource/src/volume/shm_volume.rs b/src/runtime-rs/crates/resource/src/volume/shm_volume.rs index fb12b36145..ea769b2dc1 100644 --- a/src/runtime-rs/crates/resource/src/volume/shm_volume.rs +++ b/src/runtime-rs/crates/resource/src/volume/shm_volume.rs @@ -68,7 +68,7 @@ impl ShmVolume { r#type: "tmpfs".to_string(), destination: m.destination.clone(), source: "shm".to_string(), - options: vec![ + options: [ "noexec", "nosuid", "nodev", diff --git a/src/runtime-rs/crates/resource/src/volume/spdk_volume.rs b/src/runtime-rs/crates/resource/src/volume/spdk_volume.rs index f0ea125da7..6789d6d371 100644 --- a/src/runtime-rs/crates/resource/src/volume/spdk_volume.rs +++ b/src/runtime-rs/crates/resource/src/volume/spdk_volume.rs @@ -75,7 +75,7 @@ impl SPDKVolume { let block_driver = get_block_driver(d).await; - let mut vhu_blk_config = &mut VhostUserConfig { + let vhu_blk_config = &mut VhostUserConfig { socket_path: device, device_type: VhostUserType::Blk("vhost-user-blk-pci".to_owned()), driver_option: block_driver, @@ -183,7 +183,7 @@ impl Volume for SPDKVolume { pub(crate) fn is_spdk_volume(m: &oci::Mount) -> bool { // 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()) { return true; } diff --git a/src/tools/agent-ctl/src/client.rs b/src/tools/agent-ctl/src/client.rs index 802bc79669..0c4485103b 100644 --- a/src/tools/agent-ctl/src/client.rs +++ b/src/tools/agent-ctl/src/client.rs @@ -1199,6 +1199,7 @@ fn agent_cmd_container_start( Ok(()) } +#[allow(clippy::redundant_closure_call)] fn agent_cmd_sandbox_get_guest_details( ctx: &Context, client: &AgentServiceClient, @@ -2015,6 +2016,7 @@ fn agent_cmd_sandbox_update_container( Ok(()) } +#[allow(clippy::redundant_closure_call)] fn agent_cmd_sandbox_mem_hotplug_by_probe( ctx: &Context, client: &AgentServiceClient, diff --git a/src/tools/kata-ctl/src/check.rs b/src/tools/kata-ctl/src/check.rs index 3bf899ad2e..b579be1766 100644 --- a/src/tools/kata-ctl/src/check.rs +++ b/src/tools/kata-ctl/src/check.rs @@ -5,7 +5,7 @@ // Contains checks that are not architecture-specific -#[cfg(any(target_arch = "x86_64"))] +#[cfg(target_arch = "x86_64")] use crate::types::KernelModule; use anyhow::{anyhow, Result}; @@ -17,7 +17,7 @@ use reqwest::header::{CONTENT_TYPE, USER_AGENT}; use serde::{Deserialize, Serialize}; use slog::{info, o}; -#[cfg(any(target_arch = "x86_64"))] +#[cfg(target_arch = "x86_64")] use std::process::{Command, Stdio}; #[derive(Debug, Deserialize, Serialize, PartialEq)] @@ -84,7 +84,7 @@ pub fn check_cpu_flags( Ok(missing_flags) } -#[cfg(any(target_arch = "x86_64"))] +#[cfg(target_arch = "x86_64")] pub fn check_cpu_attribs( cpu_info: &str, required_attribs: &'static [&'static str], @@ -236,7 +236,7 @@ pub fn check_official_releases() -> Result<()> { Ok(()) } -#[cfg(any(target_arch = "x86_64"))] +#[cfg(target_arch = "x86_64")] pub fn check_kernel_module_loaded(kernel_module: &KernelModule) -> Result<(), String> { const MODPROBE_PARAMETERS_DRY_RUN: &str = "--dry-run"; const MODPROBE_PARAMETERS_FIRST_TIME: &str = "--first-time"; @@ -305,7 +305,7 @@ pub fn check_kernel_module_loaded(kernel_module: &KernelModule) -> Result<(), St #[cfg(test)] mod tests { use super::*; - #[cfg(any(target_arch = "x86_64"))] + #[cfg(target_arch = "x86_64")] use crate::types::{KernelModule, KernelParam, KernelParamType}; use kata_sys_util::cpu::{get_cpu_flags, get_single_cpu_info}; use semver::Version; @@ -509,7 +509,7 @@ mod tests { assert!(!v.patch.to_string().is_empty()); } - #[cfg(any(target_arch = "x86_64"))] + #[cfg(target_arch = "x86_64")] #[test] fn check_module_loaded() { #[allow(dead_code)] diff --git a/src/tools/kata-ctl/src/ops/exec_ops.rs b/src/tools/kata-ctl/src/ops/exec_ops.rs index f7ad0170cb..f14da80e06 100644 --- a/src/tools/kata-ctl/src/ops/exec_ops.rs +++ b/src/tools/kata-ctl/src/ops/exec_ops.rs @@ -123,7 +123,7 @@ impl EpollContext { } fn do_process_handler(&mut self) -> Result<()> { - let mut events = vec![epoll::Event::new(epoll::Events::empty(), 0); EPOLL_EVENTS_LEN]; + let mut events = [epoll::Event::new(epoll::Events::empty(), 0); EPOLL_EVENTS_LEN]; let epoll_raw_fd = self.epoll_raw_fd; let debug_console_sock = self.debug_console_sock.as_mut().unwrap(); diff --git a/src/tools/kata-ctl/src/utils.rs b/src/tools/kata-ctl/src/utils.rs index f020a077e5..9c4ef4d5a5 100644 --- a/src/tools/kata-ctl/src/utils.rs +++ b/src/tools/kata-ctl/src/utils.rs @@ -60,7 +60,7 @@ fn get_field_fn(line: &str, delimiter: &str, file_name: &str) -> Result } // Ref: https://www.freedesktop.org/software/systemd/man/os-release.html pub fn get_distro_details(os_release: &str, os_release_clr: &str) -> Result<(String, String)> { - let files = vec![os_release, os_release_clr]; + let files = [os_release, os_release_clr]; let mut name = String::new(); let mut version = String::new(); @@ -239,7 +239,7 @@ mod tests { assert!(res.is_ok()); } - #[cfg(any(target_arch = "x86_64"))] + #[cfg(target_arch = "x86_64")] #[test] fn get_generic_cpu_details_system() { let res = get_generic_cpu_details(crate::check::PROC_CPUINFO); diff --git a/src/tools/runk/libcontainer/src/utils.rs b/src/tools/runk/libcontainer/src/utils.rs index b5e9d83770..ec1a71254a 100644 --- a/src/tools/runk/libcontainer/src/utils.rs +++ b/src/tools/runk/libcontainer/src/utils.rs @@ -36,7 +36,7 @@ pub fn create_dir_with_mode>(path: P, mode: Mode, recursive: bool /// If root in spec is a relative path, make it absolute. pub fn canonicalize_spec_root(spec: &mut Spec, bundle_canon: &Path) -> Result<()> { - let mut spec_root = spec + let spec_root = spec .root .as_mut() .ok_or_else(|| anyhow!("root config was not present in the spec file"))?; diff --git a/versions.yaml b/versions.yaml index d37e206fc9..c7cafb0797 100644 --- a/versions.yaml +++ b/versions.yaml @@ -356,12 +356,12 @@ languages: rust: description: "Rust language" notes: "'version' is the default minimum version used by this project." - version: "1.69.0" + version: "1.72.0" meta: description: | 'newest-version' is the latest version known to work when building Kata - newest-version: "1.69.0" + newest-version: "1.72.0" golangci-lint: description: "golangci-lint"