Avoid a reallocation

This commit is contained in:
Benoît du Garreau 2021-01-03 22:05:00 +01:00
parent 09e38e085c
commit 055df2a8df

View File

@ -282,7 +282,11 @@ pub fn list_localizations() -> Vec<LanguageMetadata> {
}
/// Return the asset associated with the language_id
pub fn i18n_asset_key(language_id: &str) -> String { "voxygen.i18n.".to_string() + language_id }
pub fn i18n_asset_key(language_id: &str) -> String {
let prefix = "voxygen.i18n.";
let s = String::with_capacity(prefix.len() + language_id.len());
s + prefix + language_id
}
#[cfg(test)]
mod tests {