diff --git a/program-runtime/src/loaded_programs.rs b/program-runtime/src/loaded_programs.rs index 869462a5e3b699..4677cbf04d79ac 100644 --- a/program-runtime/src/loaded_programs.rs +++ b/program-runtime/src/loaded_programs.rs @@ -581,13 +581,8 @@ impl LoadedPrograms { } pub fn unload_all_programs(&mut self) { - let keys = self - .entries - .keys() - .into_iter() - .map(|key| *key) - .collect::>(); - keys.iter().for_each(|key| self.unload_program(key)); + let keys = self.entries.keys().copied().collect::>(); + keys.iter().for_each(|key| self.unload_program(&key)); } fn unload_program_entries<'a>(