From 3d64b114544e9344dfaa8685b1450f06eeb77148 Mon Sep 17 00:00:00 2001 From: Ruoqing He Date: Thu, 5 Jun 2025 11:50:53 +0000 Subject: [PATCH] kata-ctl: Fix clippy `question_mark` Manually fix `question_mark` clippy warning reported by rust 1.85.1. ```console error: this `match` expression can be replaced with `?` --> src/ops/check_ops.rs:49:13 | 49 | let f = match get_builtin_check_func(check) { | _____________^ 50 | | Ok(fp) => fp, 51 | | Err(e) => return Err(e), 52 | | }; | |_____^ help: try instead: `get_builtin_check_func(check)?` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#question_mark = note: `-D clippy::question-mark` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::question_mark)]` ``` Signed-off-by: Ruoqing He --- src/tools/agent-ctl/Cargo.lock | 6 +++--- src/tools/kata-ctl/src/ops/check_ops.rs | 5 +---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/tools/agent-ctl/Cargo.lock b/src/tools/agent-ctl/Cargo.lock index 24502253b8..76ffe58502 100644 --- a/src/tools/agent-ctl/Cargo.lock +++ b/src/tools/agent-ctl/Cargo.lock @@ -632,9 +632,8 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "cgroups-rs" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db7c2f5545da4c12c5701455d9471da5f07db52e49b9cccb4f5512226dd0836" +version = "0.3.5" +source = "git+https://github.com/kata-containers/cgroups-rs?rev=v0.3.5#de9625ff57d156967b5b2a637c2c41bb2366e39b" dependencies = [ "libc", "log", @@ -3762,6 +3761,7 @@ dependencies = [ "regex", "rlimit", "runtime-spec", + "safe-path", "scan_fmt", "scopeguard", "serde", diff --git a/src/tools/kata-ctl/src/ops/check_ops.rs b/src/tools/kata-ctl/src/ops/check_ops.rs index 8388637f1e..247e32cd7c 100644 --- a/src/tools/kata-ctl/src/ops/check_ops.rs +++ b/src/tools/kata-ctl/src/ops/check_ops.rs @@ -46,10 +46,7 @@ fn get_builtin_check_func(name: CheckType) -> Result { // This function is called from each 'kata-ctl check' argument section fn handle_builtin_check(check: CheckType, args: &str) -> Result<()> { - let f = match get_builtin_check_func(check) { - Ok(fp) => fp, - Err(e) => return Err(e), - }; + let f = get_builtin_check_func(check)?; f(args) }