From d6677b331996adb6087d4f0cee02100f3f40fd0c Mon Sep 17 00:00:00 2001
From: Chris Wong <lambda.fairy@gmail.com>
Date: Thu, 30 Apr 2015 16:32:15 +1200
Subject: [PATCH] Borrow spliced values instead of moving them

Closes #13
---
 maud/src/lib.rs           | 4 ++--
 maud_macros/src/render.rs | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/maud/src/lib.rs b/maud/src/lib.rs
index 2ebc5cd..8e786a3 100644
--- a/maud/src/lib.rs
+++ b/maud/src/lib.rs
@@ -85,8 +85,8 @@ pub mod rt {
     ///
     /// See <https://github.com/rust-lang/rust/issues/16617>
     #[inline]
-    pub fn write_fmt<T: fmt::Display>(w: &mut fmt::Write, value: T) -> fmt::Result {
-        write!(w, "{}", value)
+    pub fn write_fmt<T: fmt::Display>(w: &mut fmt::Write, value: &T) -> fmt::Result {
+        write!(w, "{}", *value)
     }
 
     pub struct Escaper<'a, 'b: 'a> {
diff --git a/maud_macros/src/render.rs b/maud_macros/src/render.rs
index 6b73818..7d10eb5 100644
--- a/maud_macros/src/render.rs
+++ b/maud_macros/src/render.rs
@@ -96,12 +96,12 @@ impl<'cx> Renderer<'cx> {
         let w = self.w;
         let expr = match escape {
             Escape::PassThru =>
-                quote_expr!(self.cx, ::maud::rt::write_fmt($w, $expr)),
+                quote_expr!(self.cx, ::maud::rt::write_fmt($w, &$expr)),
             Escape::Escape =>
                 quote_expr!(self.cx,
                     ::maud::rt::write_fmt(
                         &mut ::maud::rt::Escaper { inner: $w },
-                        $expr)),
+                        &$expr)),
         };
         let stmt = self.cx.stmt_expr(self.cx.expr_try(expr.span, expr));
         self.push(stmt);