diff options
| author | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-07-18 13:22:14 +0200 |
|---|---|---|
| committer | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-07-18 13:22:14 +0200 |
| commit | 7edb7f578d5e87a4d9e28586c2e066269041cc1d (patch) | |
| tree | c8b01fcbaac4b9c39f76ea743149d020a03c1625 /src/template.rs | |
| parent | 8d11eb64efa67f1d7a6902300fdffd2c7c08df6c (diff) | |
Apply formatting
Diffstat (limited to 'src/template.rs')
| -rw-r--r-- | src/template.rs | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/template.rs b/src/template.rs index 1a00fe2..05c5db4 100644 --- a/src/template.rs +++ b/src/template.rs @@ -117,9 +117,8 @@ impl Parsed { match token { Token::Text(contents) => rendered_template.push_str(contents), Token::DisplayDirective { content } => { - let value = ContextGetter::get(context, content).ok_or_else(|| { - Error::other(format!("{content} is not a valid key")) - })?; + let value = ContextGetter::get(context, content) + .ok_or_else(|| Error::other(format!("{content} is not a valid key")))?; rendered_template.push_str(&value.render()); } Token::ConditionalDirective { @@ -133,9 +132,8 @@ impl Parsed { condition = condition[1..].to_string(); } - let value = ContextGetter::get(context, &condition).ok_or_else(|| { - Error::other(format!("{condition} is not a valid key")) - })?; + let value = ContextGetter::get(context, &condition) + .ok_or_else(|| Error::other(format!("{condition} is not a valid key")))?; match value { Value::Bool(value) => { @@ -145,9 +143,7 @@ impl Parsed { } Ok(()) } - _ => Err(Error::other( - format!("{condition} is not a boolean value"), - )), + _ => Err(Error::other(format!("{condition} is not a boolean value"))), }?; } Token::IteratorDirective { @@ -155,9 +151,8 @@ impl Parsed { member_label, children, } => { - let value = ContextGetter::get(context, collection).ok_or_else(|| { - Error::other(format!("{collection} is not a valid key")) - })?; + let value = ContextGetter::get(context, collection) + .ok_or_else(|| Error::other(format!("{collection} is not a valid key")))?; match value { Value::Collection(collection) => { @@ -170,9 +165,7 @@ impl Parsed { } Ok(()) } - _ => Err(Error::other( - format!("{collection} is not a collection"), - )), + _ => Err(Error::other(format!("{collection} is not a collection"))), }?; } } |