diff --git a/src/packages/map_basic.rs b/src/packages/map_basic.rs index b7e52bc3..213500a5 100644 --- a/src/packages/map_basic.rs +++ b/src/packages/map_basic.rs @@ -88,11 +88,11 @@ mod map_functions { pub mod indexing { #[rhai_fn(pure)] pub fn keys(map: &mut Map) -> Array { - map.iter().map(|(k, _)| k.clone().into()).collect() + map.keys().cloned().map(Into::::into).collect() } #[rhai_fn(pure)] pub fn values(map: &mut Map) -> Array { - map.iter().map(|(_, v)| v.clone()).collect() + map.values().cloned().collect() } } }