mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-19 18:01:01 +00:00
runtime-rs: Fix clippy unnecessary_map_or
Fix `unnecessary_map_or` clippy warning as suggested by rust 1.85.1. error: this `map_or` can be simplified --> crates/hypervisor/src/ch/inner_hypervisor.rs:1054:24 | 1054 | let have_tdx = fs::read(TDX_KVM_PARAMETER_PATH) | ________________________^ 1055 | | .map_or(false, |content| !content.is_empty() && content[0] == b'Y'); | |_______________________________________________________________________________^ help: use is_ok_and instead: `fs::read(TDX_KVM_PARAMETER_PATH).is_ok_and(|content| !content.is_empty() && content[0] == b'Y')` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or = note: `-D clippy::unnecessary-map-or` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_map_or)]` Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
This commit is contained in:
parent
d7dfab92be
commit
f70c17660a
@ -1052,7 +1052,7 @@ mod tests {
|
|||||||
set_fake_guest_protection(None);
|
set_fake_guest_protection(None);
|
||||||
|
|
||||||
let have_tdx = fs::read(TDX_KVM_PARAMETER_PATH)
|
let have_tdx = fs::read(TDX_KVM_PARAMETER_PATH)
|
||||||
.map_or(false, |content| !content.is_empty() && content[0] == b'Y');
|
.is_ok_and(|content| !content.is_empty() && content[0] == b'Y');
|
||||||
|
|
||||||
let protection =
|
let protection =
|
||||||
task::spawn_blocking(|| -> Result<GuestProtection> { get_guest_protection() })
|
task::spawn_blocking(|| -> Result<GuestProtection> { get_guest_protection() })
|
||||||
|
Loading…
Reference in New Issue
Block a user