Skip to content

Commit

Permalink
Derive default for UndefinedBehavior
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Nov 6, 2024
1 parent eee6878 commit a80b03f
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions minijinja/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,15 @@ pub enum AutoEscape {
///
/// At present there are three types of behaviors available which mirror the behaviors
/// that Jinja2 provides out of the box.
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Default)]
#[non_exhaustive]
pub enum UndefinedBehavior {
/// The default, somewhat lenient undefined behavior.
///
/// * **printing:** allowed (returns empty string)
/// * **iteration:** allowed (returns empty array)
/// * **attribute access of undefined values:** fails
#[default]
Lenient,
/// Like `Lenient`, but also allows chaining of undefined lookups.
///
Expand All @@ -131,12 +132,6 @@ pub enum UndefinedBehavior {
Strict,
}

impl Default for UndefinedBehavior {
fn default() -> UndefinedBehavior {
UndefinedBehavior::Lenient
}
}

impl UndefinedBehavior {
/// Utility method used in the engine to determine what to do when an undefined is
/// encountered.
Expand Down

0 comments on commit a80b03f

Please sign in to comment.