diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-08-21 16:38:51 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-08-21 17:30:21 +0200 |
| commit | 0dd4ae0a7ac0c247078df492469ff20b8a90c886 (patch) | |
| tree | 07a55343b9ccab3fe76b0f1b0de9d1be310d8b14 /src/eval/dict.rs | |
| parent | f38eb10c2b54bd13ccef119454839f6a66448462 (diff) | |
Prune derives
Diffstat (limited to 'src/eval/dict.rs')
| -rw-r--r-- | src/eval/dict.rs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/eval/dict.rs b/src/eval/dict.rs index 66baaec0..dfac04ed 100644 --- a/src/eval/dict.rs +++ b/src/eval/dict.rs @@ -82,6 +82,12 @@ fn missing_key(key: &Str) -> String { format!("dictionary does not contain key: {}", key) } +impl Debug for Dict { + fn fmt(&self, f: &mut Formatter) -> fmt::Result { + f.debug_map().entries(self.0.iter()).finish() + } +} + impl Display for Dict { fn fmt(&self, f: &mut Formatter) -> fmt::Result { f.write_char('(')?; @@ -100,12 +106,6 @@ impl Display for Dict { } } -impl Debug for Dict { - fn fmt(&self, f: &mut Formatter) -> fmt::Result { - f.debug_map().entries(self.0.iter()).finish() - } -} - impl Add for Dict { type Output = Self; @@ -124,18 +124,18 @@ impl AddAssign for Dict { } } -impl FromIterator<(Str, Value)> for Dict { - fn from_iter<T: IntoIterator<Item = (Str, Value)>>(iter: T) -> Self { - Self(Rc::new(iter.into_iter().collect())) - } -} - impl Extend<(Str, Value)> for Dict { fn extend<T: IntoIterator<Item = (Str, Value)>>(&mut self, iter: T) { Rc::make_mut(&mut self.0).extend(iter); } } +impl FromIterator<(Str, Value)> for Dict { + fn from_iter<T: IntoIterator<Item = (Str, Value)>>(iter: T) -> Self { + Self(Rc::new(iter.into_iter().collect())) + } +} + impl IntoIterator for Dict { type Item = (Str, Value); type IntoIter = std::collections::btree_map::IntoIter<Str, Value>; |
