From b70bc1d6433fc0001336c968465fbe653921491c Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Tue, 7 Oct 2025 13:56:20 +0200 Subject: Apply formatting --- src/template.rs | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'src/template.rs') diff --git a/src/template.rs b/src/template.rs index 05c5db4..00f9118 100644 --- a/src/template.rs +++ b/src/template.rs @@ -40,7 +40,7 @@ impl std::fmt::Display for Token { } => { writeln!(f, "ConditionalDirective {condition} [[[")?; for child in children { - writeln!(f, "\t{child}").unwrap(); + writeln!(f, "\t{child}")?; } write!(f, "]]]") } @@ -51,7 +51,7 @@ impl std::fmt::Display for Token { } => { writeln!(f, "IteratorDirective {member_label} in {collection} [[[")?; for child in children { - writeln!(f, "\t{child}").unwrap(); + writeln!(f, "\t{child}")?; } write!(f, "]]]") } @@ -237,18 +237,17 @@ fn tokenize(template: &str, tokens: &mut Vec) -> Result<()> { let directive_block = &remaining_template[..closing_block]; remaining_template = &remaining_template[closing_block + 5..]; tokenize(directive_block, &mut children)?; - if parts.len() == 2 { - if let Some(first_part) = parts.first() { - if let Some(second_part) = parts.get(1) { - let collection = first_part.trim().to_string(); - let member_label = second_part.trim().to_string(); - tokens.push(Token::IteratorDirective { - collection, - member_label, - children, - }); - } - } + if parts.len() == 2 + && let Some(first_part) = parts.first() + && let Some(second_part) = parts.get(1) + { + let collection = first_part.trim().to_string(); + let member_label = second_part.trim().to_string(); + tokens.push(Token::IteratorDirective { + collection, + member_label, + children, + }); } } } -- cgit