From c63206fa17bfddbd02dcd13a5c0f8e1d8afd738a Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Thu, 28 Mar 2019 15:44:25 +0100 Subject: [PATCH] Add `derive(Default)` to `HashMapContext` --- CHANGELOG.md | 2 +- src/context/mod.rs | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 38b729b..510926b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,7 @@ ### Added * Add serde support to `HashMapContext` - * Make `HashMapContext` derive default + * Make `HashMapContext` derive `Default` and `Debug` ### Changed diff --git a/src/context/mod.rs b/src/context/mod.rs index 8ab9c99..72694f1 100644 --- a/src/context/mod.rs +++ b/src/context/mod.rs @@ -49,7 +49,7 @@ impl Context for EmptyContext { /// *Value and function mappings are stored independently, meaning that there can be a function and a value with the same identifier.* /// /// This context is type-safe, meaning that an identifier that is assigned a value of some type once cannot be assigned a value of another type. -#[derive(Debug)] +#[derive(Debug, Default)] #[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))] pub struct HashMapContext { variables: HashMap, @@ -60,10 +60,7 @@ pub struct HashMapContext { impl HashMapContext { /// Constructs a `HashMapContext` with no mappings. pub fn new() -> Self { - Self { - variables: Default::default(), - functions: Default::default(), - } + Default::default() } }