mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-16 00:16:52 +00:00
dragonball: Fix clippy unnecessary_lazy_evaluations
Fix `unnecessary_lazy_evaluations` clippy warning as suggested by rust 1.85.1. ```console error: unnecessary closure used to substitute value for `Option::None` --> dbs_virtio_devices/src/vhost/vhost_user/block.rs:225:28 | 225 | let vhost_socket = config_path | ____________________________^ 226 | | .strip_prefix("spdk://") 227 | | .ok_or_else(|| VirtIoError::InvalidInput)? | |_____________________________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations = note: `-D clippy::unnecessary-lazy-evaluations` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_lazy_evaluations)]` help: use `ok_or` instead | 227 | .ok_or(VirtIoError::InvalidInput)? | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn> unnecessary_lazy_evaluations Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
This commit is contained in:
parent
16b45462a1
commit
c04f1048d5
@ -224,7 +224,7 @@ impl VhostUserBlockDevice {
|
||||
// config_path = "spdk://xxxxxxx.sock", remove the prefix "spdk://"
|
||||
let vhost_socket = config_path
|
||||
.strip_prefix("spdk://")
|
||||
.ok_or_else(|| VirtIoError::InvalidInput)?
|
||||
.ok_or(VirtIoError::InvalidInput)?
|
||||
.to_string();
|
||||
|
||||
let init_queues = queue_sizes.len() as u32;
|
||||
|
@ -253,7 +253,7 @@ impl BalloonDeviceMgr {
|
||||
let device = self.info_list[index]
|
||||
.device
|
||||
.as_ref()
|
||||
.ok_or_else(|| BalloonDeviceError::NotExist)?;
|
||||
.ok_or(BalloonDeviceError::NotExist)?;
|
||||
if let Some(mmio_dev) = device.as_any().downcast_ref::<DbsMmioV2Device>() {
|
||||
let guard = mmio_dev.state();
|
||||
let inner_dev = guard.get_inner_device();
|
||||
|
@ -325,7 +325,7 @@ impl MemDeviceMgr {
|
||||
let device = self.info_list[index]
|
||||
.device
|
||||
.as_ref()
|
||||
.ok_or_else(|| MemDeviceError::DeviceNotExist)?;
|
||||
.ok_or(MemDeviceError::DeviceNotExist)?;
|
||||
if let Some(mmio_dev) = device.as_any().downcast_ref::<DbsMmioV2Device>() {
|
||||
let guard = mmio_dev.state();
|
||||
let inner_dev = guard.get_inner_device();
|
||||
|
Loading…
Reference in New Issue
Block a user