Use Iterator to create from_list

This commit is contained in:
Aviv Palivoda
2019-06-14 08:49:20 +03:00
parent 4938c03d6f
commit e61fa6dd74

View File

@@ -908,10 +908,10 @@ impl Frame {
}
fn import(&self, vm: &VirtualMachine, module: &str, symbols: &Vec<String>) -> FrameResult {
let mut from_list = vec![];
for symbol in symbols {
from_list.push(vm.ctx.new_str(symbol.to_string()));
}
let from_list = symbols
.iter()
.map(|symbol| vm.ctx.new_str(symbol.to_string()))
.collect();
let module = vm.import(module, &vm.ctx.new_tuple(from_list))?;
if symbols.is_empty() {