aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive/src/input.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/input.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 'askama_derive/src/input.rs')
-rw-r--r--askama_derive/src/input.rs26
1 files changed, 1 insertions, 25 deletions
diff --git a/askama_derive/src/input.rs b/askama_derive/src/input.rs
index c09f3d0..68d01db 100644
--- a/askama_derive/src/input.rs
+++ b/askama_derive/src/input.rs
@@ -16,15 +16,13 @@ pub(crate) struct TemplateInput<'a> {
pub(crate) escaper: &'a str,
pub(crate) ext: Option<String>,
pub(crate) mime_type: String,
- pub(crate) parent: Option<&'a syn::Type>,
pub(crate) path: PathBuf,
}
impl TemplateInput<'_> {
/// Extract the template metadata from the `DeriveInput` structure. This
/// mostly recovers the data for the `TemplateInput` fields from the
- /// `template()` attribute list fields; it also finds the of the `_parent`
- /// field, if any.
+ /// `template()` attribute list fields.
pub(crate) fn new<'n>(
ast: &'n syn::DeriveInput,
config: &'n Config<'_>,
@@ -51,27 +49,6 @@ impl TemplateInput<'_> {
}
};
- // Check to see if a `_parent` field was defined on the context
- // struct, and store the type for it for use in the code generator.
- let parent = match ast.data {
- syn::Data::Struct(syn::DataStruct {
- fields: syn::Fields::Named(ref fields),
- ..
- }) => fields
- .named
- .iter()
- .find(|f| f.ident.as_ref().filter(|name| *name == "_parent").is_some())
- .map(|f| &f.ty),
- _ => None,
- };
-
- if parent.is_some() {
- eprint!(
- " --> in struct {}\n = use of deprecated field '_parent'\n",
- ast.ident
- );
- }
-
// Validate syntax
let syntax = syntax.map_or_else(
|| Ok(config.syntaxes.get(config.default_syntax).unwrap()),
@@ -117,7 +94,6 @@ impl TemplateInput<'_> {
escaper,
ext,
mime_type,
- parent,
path,
})
}