From e8cdc87ff87fb187f8a2ec62ced17b3d2d2e3be8 Mon Sep 17 00:00:00 2001 From: Miraculous Owonubi Date: Thu, 25 May 2023 17:25:00 +0100 Subject: [PATCH] no early return --- core/account-id/src/lib.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/account-id/src/lib.rs b/core/account-id/src/lib.rs index ab1a2ba1ddb..cc1ecf06ff0 100644 --- a/core/account-id/src/lib.rs +++ b/core/account-id/src/lib.rs @@ -379,17 +379,18 @@ impl<'a> arbitrary::Arbitrary<'a> for AccountId { fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result { let s = u.arbitrary::<&str>()?; match s.parse::() { - Ok(account_id) => return Ok(account_id), + Ok(account_id) => Ok(account_id), Err(e) => { if let Some((valid_up_to, _)) = e.char { let valid = &s[..valid_up_to]; debug_assert!(AccountId::validate(valid).is_ok()); #[allow(deprecated)] - return Ok(AccountId::new_unvalidated(valid.to_string())); + Ok(AccountId::new_unvalidated(valid.to_string())); + } else { + Err(arbitrary::Error::IncorrectFormat) } } } - Err(arbitrary::Error::IncorrectFormat) } fn arbitrary_take_rest(u: arbitrary::Unstructured<'a>) -> arbitrary::Result {