From bb78d35db8f29fd46055e178ce17e0348dc1f96c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Mon, 2 Jan 2023 13:31:06 +0100 Subject: [PATCH] kata-sys-util: Fix "match-like-matches-macro" warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As we bumped the rust toolchain to 1.66.0, some new warnings have been raised due to "match-like-matches-macro". Let's fix them all here. For more info about the warnings, please, take a look at: https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro Signed-off-by: Fabiano FidĂȘncio --- src/libs/kata-sys-util/src/validate.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/libs/kata-sys-util/src/validate.rs b/src/libs/kata-sys-util/src/validate.rs index 0847398cef..13902a6742 100644 --- a/src/libs/kata-sys-util/src/validate.rs +++ b/src/libs/kata-sys-util/src/validate.rs @@ -17,16 +17,9 @@ pub enum Error { pub fn verify_id(id: &str) -> Result<(), Error> { let mut chars = id.chars(); - let valid = match chars.next() { - Some(first) - if first.is_alphanumeric() + let valid = matches!(chars.next(), Some(first) if first.is_alphanumeric() && id.len() > 1 - && chars.all(|c| c.is_alphanumeric() || ['.', '-', '_'].contains(&c)) => - { - true - } - _ => false, - }; + && chars.all(|c| c.is_alphanumeric() || ['.', '-', '_'].contains(&c))); match valid { true => Ok(()),