diff options
| author | Ruben Beltran del Rio <jj@r.bdr.sh> | 2025-11-30 16:54:49 +0100 |
|---|---|---|
| committer | Ruben Beltran del Rio <jj@r.bdr.sh> | 2025-11-30 16:55:03 +0100 |
| commit | 7746e3602f580b30cd3f81492e079da80ca6d182 (patch) | |
| tree | 8970fde47ab2611fa3ce72f1128d9e44b684de7a | |
| parent | d8a1c8d7eefd2c5aa940179f8ef083173a7f9f4e (diff) | |
| -rw-r--r-- | src/template.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/template.rs b/src/template.rs index 00f9118..f39b315 100644 --- a/src/template.rs +++ b/src/template.rs @@ -71,7 +71,7 @@ pub enum Value { impl Value { fn render(&self) -> String { match self { - Value::String(string) => string.to_string(), + Value::String(string) => string.clone(), Value::Unsigned(number) => format!("{number}"), Value::Bool(bool) => format!("{bool}"), _ => String::new(), @@ -126,7 +126,7 @@ impl Parsed { children, } => { let mut negator = false; - let mut condition = condition.to_string(); + let mut condition = condition.clone(); if condition.starts_with('!') { negator = true; condition = condition[1..].to_string(); @@ -159,7 +159,7 @@ impl Parsed { for member in collection { let mut child_context = context.clone(); child_context - .insert(member_label.to_string(), Value::Context(member)); + .insert(member_label.clone(), Value::Context(member)); rendered_template .push_str(&Parsed::render_tokens(children, &child_context)?); } @@ -189,7 +189,7 @@ fn tokenize(template: &str, tokens: &mut Vec<Token>) -> Result<()> { .ok_or_else(|| Error::other("Was expecting at least one tag opener"))?; if directive_start_index > 0 { let text = remaining_template[..directive_start_index].to_string(); - tokens.push(Token::Text(text.to_string())); + tokens.push(Token::Text(text.clone())); } remaining_template = &remaining_template[directive_start_index..]; |