Fix old Rust woes
This commit is contained in:
@ -227,27 +227,27 @@ pub fn show(
|
|||||||
)
|
)
|
||||||
.and_then(|lang| resources::get_layout_names(lang.as_str()));
|
.and_then(|lang| resources::get_layout_names(lang.as_str()));
|
||||||
|
|
||||||
let use_codes: Box<dyn FnMut(&str) -> Translation>
|
|
||||||
= Box::new(|name| Translation(name));
|
|
||||||
|
|
||||||
let translated_names = all_layouts.iter()
|
let translated_names = all_layouts.iter()
|
||||||
.map(LayoutId::get_name)
|
.map(LayoutId::get_name);
|
||||||
// use a different closure depending on whether we have translations
|
let translated_names: Vec<Translation> = match translations {
|
||||||
.map(match translations {
|
|
||||||
Some(translations) => {
|
Some(translations) => {
|
||||||
let use_translations: Box<dyn FnMut(&str) -> Translation>
|
translated_names
|
||||||
= Box::new(move |name| {
|
.map(move |name| {
|
||||||
translations.get(name)
|
translations.get(name)
|
||||||
.map(|translation| translation.clone())
|
.map(|translation| translation.clone())
|
||||||
.unwrap_or(Translation(name))
|
.unwrap_or(Translation(name))
|
||||||
});
|
})
|
||||||
use_translations
|
.collect()
|
||||||
},
|
},
|
||||||
None => use_codes,
|
None => {
|
||||||
});
|
translated_names.map(|name| Translation(name))
|
||||||
|
.collect()
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
// sorted collection of human and machine names
|
// sorted collection of human and machine names
|
||||||
let mut human_names: Vec<(Translation, LayoutId)> = translated_names
|
let mut human_names: Vec<(Translation, LayoutId)> = translated_names
|
||||||
|
.into_iter()
|
||||||
.zip(all_layouts.clone().into_iter())
|
.zip(all_layouts.clone().into_iter())
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user