From cb57b7723975337b6c41245fffcb03865010758c Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Sat, 4 Oct 2025 15:35:42 +0200 Subject: [PATCH] compiler/rust: rewrite `match` into a simpler `if let` Part-of: --- src/compiler/rust/proc/as_slice.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/compiler/rust/proc/as_slice.rs b/src/compiler/rust/proc/as_slice.rs index d1eafbab0de..6ea28506abf 100644 --- a/src/compiler/rust/proc/as_slice.rs +++ b/src/compiler/rust/proc/as_slice.rs @@ -66,15 +66,12 @@ pub fn derive_as_slice( Data::Struct(s) => { let mut has_repr_c = false; for attr in attrs { - match attr.meta { - Meta::List(ml) => { - if ml.path.is_ident("repr") - && format!("{}", ml.tokens) == "C" - { - has_repr_c = true; - } + if let Meta::List(ml) = attr.meta { + if ml.path.is_ident("repr") + && format!("{}", ml.tokens) == "C" + { + has_repr_c = true; } - _ => (), } } assert!(has_repr_c, "Struct must be declared #[repr(C)]");