summaryrefslogtreecommitdiff
path: root/src/eval/dict.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/eval/dict.rs')
-rw-r--r--src/eval/dict.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/eval/dict.rs b/src/eval/dict.rs
index c0ddf328..e7a46b40 100644
--- a/src/eval/dict.rs
+++ b/src/eval/dict.rs
@@ -6,6 +6,7 @@ use std::rc::Rc;
use super::{Str, Value};
use crate::diag::StrResult;
+use crate::util::RcExt;
/// Create a new [`Dict`] from key-value pairs.
#[allow(unused_macros)]
@@ -135,10 +136,7 @@ impl IntoIterator for Dict {
type IntoIter = std::collections::btree_map::IntoIter<Str, Value>;
fn into_iter(self) -> Self::IntoIter {
- match Rc::try_unwrap(self.0) {
- Ok(map) => map.into_iter(),
- Err(rc) => (*rc).clone().into_iter(),
- }
+ Rc::take(self.0).into_iter()
}
}