summaryrefslogtreecommitdiff
path: root/src/exec/mod.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-06-01 12:46:01 +0200
committerLaurenz <laurmaedje@gmail.com>2021-06-01 12:55:07 +0200
commit7218892c722ca583297c0ebbda350bdf6f16d3ce (patch)
tree27ebbfaf0662c1e0dd01e7c5e9e360ab288cae4d /src/exec/mod.rs
parent9bdb0bdeffa5e4b6da9e3f6d3c1b79c506005fc5 (diff)
Refactor path handling
Diffstat (limited to 'src/exec/mod.rs')
-rw-r--r--src/exec/mod.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/exec/mod.rs b/src/exec/mod.rs
index 643d5b44..35e6b55c 100644
--- a/src/exec/mod.rs
+++ b/src/exec/mod.rs
@@ -15,9 +15,6 @@ use crate::pretty::pretty;
use crate::syntax::*;
/// Execute a template to produce a layout tree.
-///
-/// The `state` is the base state that may be updated over the course of
-/// execution.
pub fn exec(template: &TemplateValue, state: State) -> Pass<layout::Tree> {
let mut ctx = ExecContext::new(state);
template.exec(&mut ctx);
@@ -53,7 +50,7 @@ impl ExecWithMap for Tree {
impl ExecWithMap for Node {
fn exec_with_map(&self, ctx: &mut ExecContext, map: &NodeMap) {
match self {
- Node::Text(text) => ctx.push_text(text.clone()),
+ Node::Text(text) => ctx.push_text(text),
Node::Space => ctx.push_word_space(),
_ => map[&(self as *const _)].exec(ctx),
}
@@ -66,7 +63,7 @@ impl Exec for Value {
Value::None => {}
Value::Int(v) => ctx.push_text(pretty(v)),
Value::Float(v) => ctx.push_text(pretty(v)),
- Value::Str(v) => ctx.push_text(v.clone()),
+ Value::Str(v) => ctx.push_text(v),
Value::Template(v) => v.exec(ctx),
Value::Error => {}
other => {
@@ -93,7 +90,7 @@ impl Exec for TemplateNode {
fn exec(&self, ctx: &mut ExecContext) {
match self {
Self::Tree { tree, map } => tree.exec_with_map(ctx, &map),
- Self::Str(v) => ctx.push_text(v.clone()),
+ Self::Str(v) => ctx.push_text(v),
Self::Func(v) => v.exec(ctx),
}
}