aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive/src/generator.rs
diff options
context:
space:
mode:
authorLibravatar René Kijewski <kijewski@library.vetmed.fu-berlin.de>2022-07-20 15:38:30 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2022-07-25 11:41:04 +0200
commit16a37f409776775341c5de8a8812eaeb8b1fe7f0 (patch)
treeea72b3a26ceb2c460742a251f4b92678fbc4f1e5 /askama_derive/src/generator.rs
parentbd8d2f334ed2a9fd0fb1bb6f9d87b4ab45556918 (diff)
downloadaskama-16a37f409776775341c5de8a8812eaeb8b1fe7f0.tar.gz
askama-16a37f409776775341c5de8a8812eaeb8b1fe7f0.tar.bz2
askama-16a37f409776775341c5de8a8812eaeb8b1fe7f0.zip
Remove support for deprecated `_parent` field
The support for the magic `_parent` field is deprecated since v0.8.0 or issue #180. It's bothersome to keep this feature alive, when no-one should be using it for 3 years.
Diffstat (limited to '')
-rw-r--r--askama_derive/src/generator.rs23
1 files changed, 0 insertions, 23 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
index 5b8c19e..5921609 100644
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -293,11 +293,6 @@ impl<'a> Generator<'a> {
// Takes a Context and generates the relevant implementations.
fn build(mut self, ctx: &'a Context<'_>) -> Result<String, CompileError> {
let mut buf = Buffer::new(0);
- if !ctx.blocks.is_empty() {
- if let Some(parent) = self.input.parent {
- self.deref_to_parent(&mut buf, parent)?;
- }
- };
self.impl_template(ctx, &mut buf)?;
self.impl_display(&mut buf)?;
@@ -378,24 +373,6 @@ impl<'a> Generator<'a> {
Ok(())
}
- // Implement `Deref<Parent>` for an inheriting context struct.
- fn deref_to_parent(
- &mut self,
- buf: &mut Buffer,
- parent_type: &syn::Type,
- ) -> Result<(), CompileError> {
- self.write_header(buf, "::std::ops::Deref", None)?;
- buf.writeln(&format!(
- "type Target = {};",
- parent_type.into_token_stream()
- ))?;
- buf.writeln("#[inline]")?;
- buf.writeln("fn deref(&self) -> &Self::Target {")?;
- buf.writeln("&self._parent")?;
- buf.writeln("}")?;
- buf.writeln("}")
- }
-
// Implement `Display` for the given context struct.
fn impl_display(&mut self, buf: &mut Buffer) -> Result<(), CompileError> {
self.write_header(buf, "::std::fmt::Display", None)?;