Merge pull request #7811 from stevenhorsman/bump-rust-to-1.72

versions: Bump rust version
This commit is contained in:
Greg Kurz 2023-09-12 15:30:35 +02:00 committed by GitHub
commit be71a0ab4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 25 additions and 21 deletions

View File

@ -195,6 +195,7 @@ impl FromStr for AgentConfig {
impl AgentConfig { impl AgentConfig {
#[instrument] #[instrument]
#[allow(clippy::redundant_closure_call)]
pub fn from_cmdline(file: &str, args: Vec<String>) -> Result<AgentConfig> { pub fn from_cmdline(file: &str, args: Vec<String>) -> Result<AgentConfig> {
// If config file specified in the args, generate our config from it // If config file specified in the args, generate our config from it
let config_position = args.iter().position(|a| a == "--config" || a == "-c"); 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.server_addr, "vsock://8:2048");
assert_eq!( assert_eq!(
config.endpoints.allowed, config.endpoints.allowed,
vec!["CreateContainer".to_string(), "StartContainer".to_string()] ["CreateContainer".to_string(), "StartContainer".to_string()]
.iter() .iter()
.cloned() .cloned()
.collect() .collect()

View File

@ -10,6 +10,7 @@
#![allow(non_snake_case)] #![allow(non_snake_case)]
#![allow(missing_docs)] #![allow(missing_docs)]
#![allow(deref_nullptr)] #![allow(deref_nullptr)]
#![allow(ambiguous_glob_reexports)]
// generated with bindgen /usr/include/linux/if.h --no-unstable-rust // generated with bindgen /usr/include/linux/if.h --no-unstable-rust
// --constified-enum '*' --with-derive-default -- -D __UAPI_DEF_IF_IFNAMSIZ -D // --constified-enum '*' --with-derive-default -- -D __UAPI_DEF_IF_IFNAMSIZ -D

View File

@ -832,7 +832,7 @@ mod hotplug {
#[cfg(all(target_arch = "x86_64", feature = "dbs-upcall"))] #[cfg(all(target_arch = "x86_64", feature = "dbs-upcall"))]
use dbs_boot::mptable::APIC_VERSION; use dbs_boot::mptable::APIC_VERSION;
#[cfg(all(target_arch = "aarch64"))] #[cfg(target_arch = "aarch64")]
const APIC_VERSION: u8 = 0; const APIC_VERSION: u8 = 0;
#[cfg(feature = "dbs-upcall")] #[cfg(feature = "dbs-upcall")]

View File

@ -245,7 +245,7 @@ mod tests {
fn test_scoped_resolve_invalid() { fn test_scoped_resolve_invalid() {
scoped_resolve("./root_is_not_absolute_path", ".").unwrap_err(); scoped_resolve("./root_is_not_absolute_path", ".").unwrap_err();
scoped_resolve("C:", ".").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(); scoped_resolve(r#"http://localhost/test"#, ".").unwrap_err();
// Chinese Unicode characters // Chinese Unicode characters
scoped_resolve(r#"您好"#, ".").unwrap_err(); scoped_resolve(r#"您好"#, ".").unwrap_err();

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

@ -75,7 +75,7 @@ impl SPDKVolume {
let block_driver = get_block_driver(d).await; let block_driver = get_block_driver(d).await;
let mut vhu_blk_config = &mut VhostUserConfig { let vhu_blk_config = &mut VhostUserConfig {
socket_path: device, socket_path: device,
device_type: VhostUserType::Blk("vhost-user-blk-pci".to_owned()), device_type: VhostUserType::Blk("vhost-user-blk-pci".to_owned()),
driver_option: block_driver, driver_option: block_driver,
@ -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;
} }

View File

@ -1199,6 +1199,7 @@ fn agent_cmd_container_start(
Ok(()) Ok(())
} }
#[allow(clippy::redundant_closure_call)]
fn agent_cmd_sandbox_get_guest_details( fn agent_cmd_sandbox_get_guest_details(
ctx: &Context, ctx: &Context,
client: &AgentServiceClient, client: &AgentServiceClient,
@ -2015,6 +2016,7 @@ fn agent_cmd_sandbox_update_container(
Ok(()) Ok(())
} }
#[allow(clippy::redundant_closure_call)]
fn agent_cmd_sandbox_mem_hotplug_by_probe( fn agent_cmd_sandbox_mem_hotplug_by_probe(
ctx: &Context, ctx: &Context,
client: &AgentServiceClient, client: &AgentServiceClient,

View File

@ -5,7 +5,7 @@
// Contains checks that are not architecture-specific // Contains checks that are not architecture-specific
#[cfg(any(target_arch = "x86_64"))] #[cfg(target_arch = "x86_64")]
use crate::types::KernelModule; use crate::types::KernelModule;
use anyhow::{anyhow, Result}; use anyhow::{anyhow, Result};
@ -17,7 +17,7 @@ use reqwest::header::{CONTENT_TYPE, USER_AGENT};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use slog::{info, o}; use slog::{info, o};
#[cfg(any(target_arch = "x86_64"))] #[cfg(target_arch = "x86_64")]
use std::process::{Command, Stdio}; use std::process::{Command, Stdio};
#[derive(Debug, Deserialize, Serialize, PartialEq)] #[derive(Debug, Deserialize, Serialize, PartialEq)]
@ -84,7 +84,7 @@ pub fn check_cpu_flags(
Ok(missing_flags) Ok(missing_flags)
} }
#[cfg(any(target_arch = "x86_64"))] #[cfg(target_arch = "x86_64")]
pub fn check_cpu_attribs( pub fn check_cpu_attribs(
cpu_info: &str, cpu_info: &str,
required_attribs: &'static [&'static str], required_attribs: &'static [&'static str],
@ -236,7 +236,7 @@ pub fn check_official_releases() -> Result<()> {
Ok(()) Ok(())
} }
#[cfg(any(target_arch = "x86_64"))] #[cfg(target_arch = "x86_64")]
pub fn check_kernel_module_loaded(kernel_module: &KernelModule) -> Result<(), String> { pub fn check_kernel_module_loaded(kernel_module: &KernelModule) -> Result<(), String> {
const MODPROBE_PARAMETERS_DRY_RUN: &str = "--dry-run"; const MODPROBE_PARAMETERS_DRY_RUN: &str = "--dry-run";
const MODPROBE_PARAMETERS_FIRST_TIME: &str = "--first-time"; 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)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
#[cfg(any(target_arch = "x86_64"))] #[cfg(target_arch = "x86_64")]
use crate::types::{KernelModule, KernelParam, KernelParamType}; use crate::types::{KernelModule, KernelParam, KernelParamType};
use kata_sys_util::cpu::{get_cpu_flags, get_single_cpu_info}; use kata_sys_util::cpu::{get_cpu_flags, get_single_cpu_info};
use semver::Version; use semver::Version;
@ -509,7 +509,7 @@ mod tests {
assert!(!v.patch.to_string().is_empty()); assert!(!v.patch.to_string().is_empty());
} }
#[cfg(any(target_arch = "x86_64"))] #[cfg(target_arch = "x86_64")]
#[test] #[test]
fn check_module_loaded() { fn check_module_loaded() {
#[allow(dead_code)] #[allow(dead_code)]

View File

@ -123,7 +123,7 @@ impl EpollContext {
} }
fn do_process_handler(&mut self) -> Result<()> { 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 epoll_raw_fd = self.epoll_raw_fd;
let debug_console_sock = self.debug_console_sock.as_mut().unwrap(); let debug_console_sock = self.debug_console_sock.as_mut().unwrap();

View File

@ -60,7 +60,7 @@ fn get_field_fn(line: &str, delimiter: &str, file_name: &str) -> Result<String>
} }
// Ref: https://www.freedesktop.org/software/systemd/man/os-release.html // 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)> { 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 name = String::new();
let mut version = String::new(); let mut version = String::new();
@ -239,7 +239,7 @@ mod tests {
assert!(res.is_ok()); assert!(res.is_ok());
} }
#[cfg(any(target_arch = "x86_64"))] #[cfg(target_arch = "x86_64")]
#[test] #[test]
fn get_generic_cpu_details_system() { fn get_generic_cpu_details_system() {
let res = get_generic_cpu_details(crate::check::PROC_CPUINFO); let res = get_generic_cpu_details(crate::check::PROC_CPUINFO);

View File

@ -36,7 +36,7 @@ pub fn create_dir_with_mode<P: AsRef<Path>>(path: P, mode: Mode, recursive: bool
/// If root in spec is a relative path, make it absolute. /// If root in spec is a relative path, make it absolute.
pub fn canonicalize_spec_root(spec: &mut Spec, bundle_canon: &Path) -> Result<()> { pub fn canonicalize_spec_root(spec: &mut Spec, bundle_canon: &Path) -> Result<()> {
let mut spec_root = spec let spec_root = spec
.root .root
.as_mut() .as_mut()
.ok_or_else(|| anyhow!("root config was not present in the spec file"))?; .ok_or_else(|| anyhow!("root config was not present in the spec file"))?;

View File

@ -356,12 +356,12 @@ languages:
rust: rust:
description: "Rust language" description: "Rust language"
notes: "'version' is the default minimum version used by this project." notes: "'version' is the default minimum version used by this project."
version: "1.69.0" version: "1.72.0"
meta: meta:
description: | description: |
'newest-version' is the latest version known to work when 'newest-version' is the latest version known to work when
building Kata building Kata
newest-version: "1.69.0" newest-version: "1.72.0"
golangci-lint: golangci-lint:
description: "golangci-lint" description: "golangci-lint"