Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit bff0fae

Browse files
Remove quote dependency
1 parent f8001c1 commit bff0fae

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

askama_derive/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,5 @@ with-warp = []
3434
parser = { package = "askama_parser", version = "0.2", path = "../askama_parser" }
3535
mime = "0.3"
3636
mime_guess = "2"
37-
quote = "1"
3837
serde = { version = "1.0", optional = true, features = ["derive"] }
3938
basic-toml = { version = "0.1.1", optional = true }

askama_derive/src/generator.rs

+6-15
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use parser::node::{
1111
Call, Comment, CondTest, If, Include, Let, Lit, Loop, Match, Target, Whitespace, Ws,
1212
};
1313
use parser::{Expr, Node};
14-
use quote::quote;
1514

1615
pub(crate) struct Generator<'a> {
1716
// The template input state: original struct AST and attributes
@@ -105,12 +104,7 @@ impl<'a> Generator<'a> {
105104
};
106105
if path_is_valid {
107106
let path = path.to_str().unwrap();
108-
buf.writeln(
109-
&quote! {
110-
include_bytes!(#path);
111-
}
112-
.to_string(),
113-
)?;
107+
buf.writeln(&format!("include_bytes!({path:?});"))?;
114108
}
115109
}
116110

@@ -244,13 +238,15 @@ for ::askama_hyper::hyper::Body
244238

245239
buf.writeln(&format!(
246240
"\
247-
impl {generics_with_bounds} ::mendes::application::IntoResponse<A> for {type_name} {orig_ty_generics} {{
241+
impl {generics_with_bounds} ::mendes::application::IntoResponse<A> for {type_name} {orig_ty_generics}
242+
{where_clause} {{
248243
fn into_response(self, app: &A, req: &::mendes::http::request::Parts) \
249244
-> ::mendes::http::Response<A::ResponseBody> {{
250245
::askama_mendes::into_response(app, req, &self)
251246
}}
252247
}}",
253-
))
248+
))?;
249+
Ok(())
254250
}
255251

256252
// Implement Rocket's `Responder`.
@@ -802,12 +798,7 @@ impl {generics_with_bounds} ::mendes::application::IntoResponse<A> for {type_nam
802798
// Make sure the compiler understands that the generated code depends on the template file.
803799
{
804800
let path = path.to_str().unwrap();
805-
buf.writeln(
806-
&quote! {
807-
include_bytes!(#path);
808-
}
809-
.to_string(),
810-
)?;
801+
buf.writeln(&format!("include_bytes!({path:?});"))?;
811802
}
812803

813804
// We clone the context of the child in order to preserve their macros and imports.

0 commit comments

Comments
 (0)