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 {
#[instrument]
#[allow(clippy::redundant_closure_call)]
pub fn from_cmdline(file: &str, args: Vec<String>) -> Result<AgentConfig> {
// 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()

View File

@ -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

View File

@ -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")]

View File

@ -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();

View File

@ -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",

View File

@ -181,7 +181,7 @@ impl Volume for BlockVolume {
}
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()) {
return Ok(false);
}

View File

@ -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",

View File

@ -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;
}

View File

@ -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,

View File

@ -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)]

View File

@ -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();

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
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);

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.
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"))?;

View File

@ -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"