optimise new_unique_id()
This commit is contained in:
parent
ac8756f3b2
commit
fd91e333a5
|
@ -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()) {
|
||||||
|
|
Loading…
Reference in New Issue