Skip to content

Commit ff33fbb

Browse files
committed
Move serde warning to Environment::new to make it more visible
1 parent ee79e3b commit ff33fbb

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

minijinja/src/environment.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,15 @@ impl<'source> Environment<'source> {
8585
/// the default filters, tests and globals loaded. If you do not want any
8686
/// default configuration you can use the alternative
8787
/// [`empty`](Environment::empty) method.
88+
#[cfg_attr(
89+
not(feature = "serde"),
90+
deprecated(
91+
since = "2.0.4",
92+
note = "Attempted to instanciate an environment with serde. Future \
93+
versions of MiniJinja will require enabling the 'serde' feature to use \
94+
serde types. To silence this warning add 'serde' to the list of features of minijinja."
95+
)
96+
)]
8897
pub fn new() -> Environment<'source> {
8998
Environment {
9099
templates: TemplateStore::new(TemplateConfig::new(Arc::new(

minijinja/src/lib.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -246,23 +246,6 @@ pub use self::value::Value;
246246
pub use self::macros::__context;
247247
pub use self::vm::State;
248248

249-
// forwards compatibility
250-
#[cfg(not(feature = "serde"))]
251-
const _: () = {
252-
#[deprecated(
253-
since = "2.0.4",
254-
note = "Future versions of MiniJinja will require enabling \
255-
the 'serde' feature to use serde types. To silence this warning \
256-
add 'serde' to the list of features of minijinja."
257-
)]
258-
#[allow(unused)]
259-
fn enable_implicit_serde_support() {}
260-
261-
fn trigger_warning() {
262-
enable_implicit_serde_support();
263-
}
264-
};
265-
266249
/// This module gives access to the low level machinery.
267250
///
268251
/// This module is only provided by the `unstable_machinery` feature and does not

0 commit comments

Comments
 (0)