From 60a8a5bf4a4c5689c27259faa40bb746d4d32145 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Mon, 2 Jan 2023 15:40:42 +0100 Subject: [PATCH] agent: Fix CCv0 specific "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/agent/src/rpc.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/agent/src/rpc.rs b/src/agent/src/rpc.rs index ce82f6c05..b9b44b715 100644 --- a/src/agent/src/rpc.rs +++ b/src/agent/src/rpc.rs @@ -154,16 +154,9 @@ pub struct AgentService { pub fn verify_cid(id: &str) -> Result<()> { 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(()),