optimise new_unique_id()

This commit is contained in:
Max Bradbury 2020-06-28 09:19:55 +01:00
parent ac8756f3b2
commit fd91e333a5
1 changed files with 1 additions and 4 deletions

View File

@ -165,10 +165,7 @@ fn is_id_available(ids: &Vec<String>, id: &String) -> bool {
/// e.g. pass all tile IDs into this to get a new non-conflicting tile ID /// e.g. pass all tile IDs into this to get a new non-conflicting tile ID
#[inline] #[inline]
fn new_unique_id(mut ids: Vec<String>) -> String { fn new_unique_id(ids: Vec<String>) -> String {
ids.sort();
ids.dedup();
let mut new_id: u64 = 0; let mut new_id: u64 = 0;
while ids.contains(&new_id.to_base36()) { while ids.contains(&new_id.to_base36()) {