aboutsummaryrefslogtreecommitdiff
path: root/src/template.rs
diff options
context:
space:
mode:
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,
+ });
}
}
}