From 56cee872e8716bc2b697aa346f88bfe511c0c48f Mon Sep 17 00:00:00 2001 From: Jacob Wahlgren Date: Thu, 12 Oct 2017 21:50:33 +0200 Subject: [PATCH 1/2] Box Handlebars template error See https://github.com/azerupi/mdBook/pull/466#issuecomment-335450110 --- src/lib.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 247d6346..cec4617d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -105,7 +105,7 @@ pub mod errors { foreign_links { Io(::std::io::Error); HandlebarsRender(::handlebars::RenderError); - HandlebarsTemplate(::handlebars::TemplateError); + HandlebarsTemplate(Box<::handlebars::TemplateError>); Utf8(::std::string::FromUtf8Error); } @@ -116,4 +116,11 @@ pub mod errors { } } } + + // Box to halve the size of Error + impl From<::handlebars::TemplateError> for Error { + fn from(e: ::handlebars::TemplateError) -> Error { + From::from(Box::new(e)) + } + } } From 7e5892bd35159dfe7d1fd806511d94a1f52748be Mon Sep 17 00:00:00 2001 From: Jacob Wahlgren Date: Thu, 12 Oct 2017 22:14:48 +0200 Subject: [PATCH 2/2] Ignore unhelpful clippy warning As discussed in https://github.com/azerupi/mdBook/pull/466 --- src/renderer/html_handlebars/hbs_renderer.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/renderer/html_handlebars/hbs_renderer.rs b/src/renderer/html_handlebars/hbs_renderer.rs index 2d8ab7fd..20323eec 100644 --- a/src/renderer/html_handlebars/hbs_renderer.rs +++ b/src/renderer/html_handlebars/hbs_renderer.rs @@ -124,6 +124,7 @@ impl HtmlHandlebars { Ok(()) } + #[cfg_attr(feature = "cargo-clippy", allow(let_and_return))] fn post_process(&self, rendered: String, filepath: &str,