From 695e2456569a527f55cdd50a1f68255fbfcfb119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolphe=20Br=C3=A9ard?= Date: Mon, 31 Jul 2023 22:51:56 +0200 Subject: [PATCH] Re-format code --- src/address.rs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/address.rs b/src/address.rs index 5fe90bc..7b856a9 100644 --- a/src/address.rs +++ b/src/address.rs @@ -17,10 +17,12 @@ impl CodedAddress { pub fn parse(s: &str, separator: char) -> Result { let (local_part, domain) = split_local_part(s); ensure!(!local_part.is_empty(), "{s}: local part cannot be empty"); - let domain = domain.map(|dom| -> Result { - ensure!(!dom.is_empty(), "{s}: domain cannot be empty"); - Ok(idna::domain_to_ascii(&dom)?) - }).transpose()?; + let domain = domain + .map(|dom| -> Result { + ensure!(!dom.is_empty(), "{s}: domain cannot be empty"); + Ok(idna::domain_to_ascii(&dom)?) + }) + .transpose()?; let parts: Vec<&str> = local_part.split(separator).collect(); let local_part = parts[0].to_string(); ensure!(!local_part.is_empty(), "{s}: local part cannot be empty"); @@ -109,10 +111,12 @@ impl FromStr for KeyedAddress { let (address, key_b64) = ksplit.unwrap(); let (local_part, domain) = split_local_part(address); ensure!(!local_part.is_empty(), "{s}: local part cannot be empty"); - let domain = domain.map(|dom| -> Result { - ensure!(!dom.is_empty(), "{s}: domain cannot be empty"); - Ok(idna::domain_to_ascii(&dom)?) - }).transpose()?; + let domain = domain + .map(|dom| -> Result { + ensure!(!dom.is_empty(), "{s}: domain cannot be empty"); + Ok(idna::domain_to_ascii(&dom)?) + }) + .transpose()?; let key = BASE64.decode(key_b64.as_bytes())?; ensure!(!key.is_empty(), "{s}: key cannot be empty"); Ok(Self {