Skip to content

Commit 72d0a72

Browse files
committed
Use serde type system for handlebars
This will help cargo to drop rustc_serialize as dependency
1 parent 19ea423 commit 72d0a72

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ fs2 = "0.4"
2828
git2 = "0.6"
2929
git2-curl = "0.7"
3030
glob = "0.2"
31-
handlebars = "0.25"
31+
handlebars = { version = "0.25", features = ["serde_type", "partial4"], default-features = false }
3232
libc = "0.2"
3333
libgit2-sys = "0.6"
3434
log = "0.3"

src/cargo/util/template.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub fn toml_escape_helper(h: &Helper,
1818
_: &Handlebars,
1919
rc: &mut RenderContext) -> Result<(), RenderError> {
2020
if let Some(param) = h.param(0) {
21-
let txt = param.value().as_string().unwrap_or("").to_owned();
21+
let txt = param.value().as_str().unwrap_or("").to_owned();
2222
let rendered = format!("{}", toml::Value::String(txt));
2323
try!(rc.writer.write_all(rendered.into_bytes().as_ref()));
2424
}
@@ -30,7 +30,7 @@ pub fn html_escape_helper(h: &Helper,
3030
_: &Handlebars,
3131
rc: &mut RenderContext) -> Result<(), RenderError> {
3232
if let Some(param) = h.param(0) {
33-
let rendered = html_escape(param.value().as_string().unwrap_or(""));
33+
let rendered = html_escape(param.value().as_str().unwrap_or(""));
3434
try!(rc.writer.write_all(rendered.into_bytes().as_ref()));
3535
}
3636
Ok(())

0 commit comments

Comments
 (0)