aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--askama_derive/src/generator.rs16
-rw-r--r--askama_derive/src/lib.rs2
2 files changed, 10 insertions, 8 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
index 74d1869..8d120be 100644
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -1775,13 +1775,6 @@ impl<'a, K: 'a, V: 'a> MapChain<'a, K, V>
where
K: cmp::Eq + hash::Hash,
{
- pub(crate) fn new() -> MapChain<'a, K, V> {
- MapChain {
- parent: None,
- scopes: vec![HashMap::new()],
- }
- }
-
fn with_parent<'p>(parent: &'p MapChain<'_, K, V>) -> MapChain<'p, K, V> {
MapChain {
parent: Some(parent),
@@ -1844,6 +1837,15 @@ impl MapChain<'_, &str, LocalMeta> {
}
}
+impl<'a, K: Eq + hash::Hash, V> Default for MapChain<'a, K, V> {
+ fn default() -> Self {
+ Self {
+ parent: None,
+ scopes: vec![HashMap::new()],
+ }
+ }
+}
+
/// Returns `true` if enough assumptions can be made,
/// to determine that `self` is copyable.
fn is_copyable(expr: &Expr<'_>) -> bool {
diff --git a/askama_derive/src/lib.rs b/askama_derive/src/lib.rs
index dc8ca75..37e8a3b 100644
--- a/askama_derive/src/lib.rs
+++ b/askama_derive/src/lib.rs
@@ -70,7 +70,7 @@ pub(crate) fn build_template(ast: &syn::DeriveInput) -> Result<String, CompileEr
&input,
&contexts,
heritage.as_ref(),
- MapChain::new(),
+ MapChain::default(),
config.whitespace,
)
.build(&contexts[input.path.as_path()])?;