From 733cbe94eeda3f714ec501d8b778746ac3351596 Mon Sep 17 00:00:00 2001 From: Dorota Czaplejewicz Date: Sun, 8 Dec 2019 18:39:02 +0000 Subject: [PATCH] Fix old Rust woes --- src/popover.rs | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/popover.rs b/src/popover.rs index 4f0f20ab..2319fc6d 100644 --- a/src/popover.rs +++ b/src/popover.rs @@ -227,27 +227,27 @@ pub fn show( ) .and_then(|lang| resources::get_layout_names(lang.as_str())); - let use_codes: Box Translation> - = Box::new(|name| Translation(name)); - let translated_names = all_layouts.iter() - .map(LayoutId::get_name) - // use a different closure depending on whether we have translations - .map(match translations { - Some(translations) => { - let use_translations: Box Translation> - = Box::new(move |name| { - translations.get(name) - .map(|translation| translation.clone()) - .unwrap_or(Translation(name)) - }); - use_translations - }, - None => use_codes, - }); + .map(LayoutId::get_name); + let translated_names: Vec = match translations { + Some(translations) => { + translated_names + .map(move |name| { + translations.get(name) + .map(|translation| translation.clone()) + .unwrap_or(Translation(name)) + }) + .collect() + }, + None => { + translated_names.map(|name| Translation(name)) + .collect() + }, + }; // sorted collection of human and machine names let mut human_names: Vec<(Translation, LayoutId)> = translated_names + .into_iter() .zip(all_layouts.clone().into_iter()) .collect();