aboutsummaryrefslogtreecommitdiff
path: root/src/template.rs
diff options
context:
space:
mode:
authorRuben Beltran del Rio <git@r.bdr.sh>2025-10-07 13:56:20 +0200
committerRuben Beltran del Rio <git@r.bdr.sh>2025-10-07 13:56:20 +0200
commitb70bc1d6433fc0001336c968465fbe653921491c (patch)
tree17be596f5c512538000bccedfb2d47adfaf3da83 /src/template.rs
parente953c7890abcbe6dfc612d4b307a7238cb2bb93c (diff)
Apply formatting
Diffstat (limited to 'src/template.rs')
-rw-r--r--src/template.rs27
1 files changed, 13 insertions, 14 deletions
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<Token>) -> 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,
+ });
}
}
}