Skip to content

Commit

Permalink
Use serde type system for handlebars
Browse files Browse the repository at this point in the history
This will help cargo to drop rustc_serialize as dependency
  • Loading branch information
sunng87 committed Mar 3, 2017
1 parent 19ea423 commit 72d0a72
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fs2 = "0.4"
git2 = "0.6"
git2-curl = "0.7"
glob = "0.2"
handlebars = "0.25"
handlebars = { version = "0.25", features = ["serde_type", "partial4"], default-features = false }
libc = "0.2"
libgit2-sys = "0.6"
log = "0.3"
Expand Down
4 changes: 2 additions & 2 deletions src/cargo/util/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub fn toml_escape_helper(h: &Helper,
_: &Handlebars,
rc: &mut RenderContext) -> Result<(), RenderError> {
if let Some(param) = h.param(0) {
let txt = param.value().as_string().unwrap_or("").to_owned();
let txt = param.value().as_str().unwrap_or("").to_owned();
let rendered = format!("{}", toml::Value::String(txt));
try!(rc.writer.write_all(rendered.into_bytes().as_ref()));
}
Expand All @@ -30,7 +30,7 @@ pub fn html_escape_helper(h: &Helper,
_: &Handlebars,
rc: &mut RenderContext) -> Result<(), RenderError> {
if let Some(param) = h.param(0) {
let rendered = html_escape(param.value().as_string().unwrap_or(""));
let rendered = html_escape(param.value().as_str().unwrap_or(""));
try!(rc.writer.write_all(rendered.into_bytes().as_ref()));
}
Ok(())
Expand Down

0 comments on commit 72d0a72

Please sign in to comment.