Refine code.

This commit is contained in:
Stephen Chung 2021-09-12 14:33:48 +08:00
parent 96dbbc76e4
commit b961a10d27

View File

@ -88,11 +88,11 @@ mod map_functions {
pub mod indexing { pub mod indexing {
#[rhai_fn(pure)] #[rhai_fn(pure)]
pub fn keys(map: &mut Map) -> Array { pub fn keys(map: &mut Map) -> Array {
map.iter().map(|(k, _)| k.clone().into()).collect() map.keys().cloned().map(Into::<Dynamic>::into).collect()
} }
#[rhai_fn(pure)] #[rhai_fn(pure)]
pub fn values(map: &mut Map) -> Array { pub fn values(map: &mut Map) -> Array {
map.iter().map(|(_, v)| v.clone()).collect() map.values().cloned().collect()
} }
} }
} }