From 320aecfe83487bafbb64e513ddc59af6dc0e80fc Mon Sep 17 00:00:00 2001 From: Sam Johnson Date: Fri, 9 Aug 2024 10:58:23 -0400 Subject: [PATCH] fix clippy warning --- support/linting/src/require_freeze_struct.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/support/linting/src/require_freeze_struct.rs b/support/linting/src/require_freeze_struct.rs index aa84b6d5c..ca6232297 100644 --- a/support/linting/src/require_freeze_struct.rs +++ b/support/linting/src/require_freeze_struct.rs @@ -78,11 +78,10 @@ mod tests { let item_struct: ItemStruct = syn::parse_str(input).expect("should only use on a struct"); let mut visitor = EncodeDecodeVisitor::default(); visitor.visit_item_struct(&item_struct); - if visitor.errors.is_empty() { - Ok(()) - } else { - Err(visitor.errors[0].clone()) + if let Some(error) = visitor.errors.first() { + return Err(error.clone()); } + Ok(()) } #[test]