mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-10-23 13:13:21 +00:00
warning_fix: fix warnings when build with cargo-1.68.0
Fixes: #6593 Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
This commit is contained in:
@@ -20,14 +20,9 @@ impl Empty {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for FSGroupChangePolicy {
|
||||
fn default() -> Self {
|
||||
FSGroupChangePolicy::Always
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[derive(Default, Debug, Clone, PartialEq)]
|
||||
pub enum FSGroupChangePolicy {
|
||||
#[default]
|
||||
Always = 0,
|
||||
OnRootMismatch = 1,
|
||||
}
|
||||
@@ -65,18 +60,13 @@ pub struct Storage {
|
||||
pub mount_point: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Clone, PartialEq, Eq, Debug, Hash)]
|
||||
#[derive(Deserialize, Default, Clone, PartialEq, Eq, Debug, Hash)]
|
||||
pub enum IPFamily {
|
||||
#[default]
|
||||
V4 = 0,
|
||||
V6 = 1,
|
||||
}
|
||||
|
||||
impl ::std::default::Default for IPFamily {
|
||||
fn default() -> Self {
|
||||
IPFamily::V4
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, PartialEq, Clone, Default)]
|
||||
pub struct IPAddress {
|
||||
pub family: IPFamily,
|
||||
|
@@ -42,7 +42,7 @@ impl CloudHypervisorInner {
|
||||
match device {
|
||||
Device::ShareFsDevice(cfg) => self.handle_share_fs_device(cfg).await,
|
||||
Device::HybridVsock(cfg) => self.handle_hvsock_device(&cfg).await,
|
||||
_ => return Err(anyhow!("unhandled device: {:?}", device)),
|
||||
_ => Err(anyhow!("unhandled device: {:?}", device)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -228,11 +228,9 @@ impl CloudHypervisorInner {
|
||||
|
||||
let join_handle = self.cloud_hypervisor_ping_until_ready(CH_POLL_TIME_MS);
|
||||
|
||||
let result = tokio::time::timeout(Duration::new(timeout_secs as u64, 0), join_handle)
|
||||
tokio::time::timeout(Duration::new(timeout_secs as u64, 0), join_handle)
|
||||
.await
|
||||
.context(timeout_msg)?;
|
||||
|
||||
result
|
||||
.context(timeout_msg)?
|
||||
}
|
||||
|
||||
async fn cloud_hypervisor_ensure_not_launched(&self) -> Result<()> {
|
||||
|
@@ -80,9 +80,7 @@ pub(crate) fn parse_ip(ip: &[u8], family: u8) -> Result<IpAddr> {
|
||||
octets.copy_from_slice(&ip[..16]);
|
||||
Ok(IpAddr::V6(Ipv6Addr::from(octets)))
|
||||
}
|
||||
_ => {
|
||||
return Err(anyhow!("unknown IP network family {}", family));
|
||||
}
|
||||
_ => Err(anyhow!("unknown IP network family {}", family)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -25,7 +25,7 @@ pub(crate) fn parse_mac(s: &str) -> Option<hypervisor::Address> {
|
||||
|
||||
pub(crate) fn get_mac_addr(b: &[u8]) -> Result<String> {
|
||||
if b.len() != 6 {
|
||||
return Err(anyhow!("invalid mac address {:?}", b));
|
||||
Err(anyhow!("invalid mac address {:?}", b))
|
||||
} else {
|
||||
Ok(format!(
|
||||
"{:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}",
|
||||
|
@@ -79,7 +79,7 @@ impl RootFsResource {
|
||||
.context("new share fs rootfs")?,
|
||||
))
|
||||
} else {
|
||||
return Err(anyhow!("share fs is unavailable"));
|
||||
Err(anyhow!("share fs is unavailable"))
|
||||
}
|
||||
}
|
||||
mounts_vec if is_single_layer_rootfs(mounts_vec) => {
|
||||
@@ -114,12 +114,10 @@ impl RootFsResource {
|
||||
inner.rootfs.push(Arc::clone(&rootfs));
|
||||
Ok(rootfs)
|
||||
}
|
||||
_ => {
|
||||
return Err(anyhow!(
|
||||
"unsupported rootfs mounts count {}",
|
||||
rootfs_mounts.len()
|
||||
))
|
||||
}
|
||||
_ => Err(anyhow!(
|
||||
"unsupported rootfs mounts count {}",
|
||||
rootfs_mounts.len()
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -397,12 +397,11 @@ fn load_config(spec: &oci::Spec, option: &Option<Vec<u8>>) -> Result<TomlConfig>
|
||||
path
|
||||
} else if let Some(option) = option {
|
||||
// get rid of the special characters in options to get the config path
|
||||
let path = if option.len() > 2 {
|
||||
if option.len() > 2 {
|
||||
from_utf8(&option[2..])?.to_string()
|
||||
} else {
|
||||
String::from("")
|
||||
};
|
||||
path
|
||||
}
|
||||
} else {
|
||||
String::from("")
|
||||
};
|
||||
|
@@ -132,7 +132,7 @@ impl Process {
|
||||
info!(self.logger, "run io copy for {}", io_name);
|
||||
let io_name = io_name.to_string();
|
||||
let logger = self.logger.new(o!("io_name" => io_name));
|
||||
let _ = tokio::spawn(async move {
|
||||
tokio::spawn(async move {
|
||||
match tokio::io::copy(&mut reader, &mut writer).await {
|
||||
Err(e) => {
|
||||
warn!(logger, "run_io_copy: failed to copy stream: {}", e);
|
||||
@@ -156,7 +156,7 @@ impl Process {
|
||||
let exit_notifier = self.exit_watcher_tx.take();
|
||||
let status = self.status.clone();
|
||||
|
||||
let _ = tokio::spawn(async move {
|
||||
tokio::spawn(async move {
|
||||
// wait on all of the container's io stream terminated
|
||||
info!(logger, "begin wait group io");
|
||||
wg.wait().await;
|
||||
|
@@ -47,7 +47,7 @@ impl HealthCheck {
|
||||
|
||||
let stop_rx = self.stop_rx.clone();
|
||||
let keep_abnormal = self.keep_abnormal;
|
||||
let _ = tokio::spawn(async move {
|
||||
tokio::spawn(async move {
|
||||
let mut version_check_threshold_count = 0;
|
||||
|
||||
loop {
|
||||
|
@@ -285,7 +285,7 @@ impl Sandbox for VirtSandbox {
|
||||
let agent = self.agent.clone();
|
||||
let sender = self.msg_sender.clone();
|
||||
info!(sl!(), "oom watcher start");
|
||||
let _ = tokio::spawn(async move {
|
||||
tokio::spawn(async move {
|
||||
loop {
|
||||
match agent
|
||||
.get_oom_event(agent::Empty::new())
|
||||
|
Reference in New Issue
Block a user