refactor new_unique_id()

This commit is contained in:
Max Bradbury 2020-06-27 20:22:15 +01:00
parent 5f736cc653
commit 6689fe1e1f
1 changed files with 2 additions and 9 deletions

View File

@ -171,16 +171,9 @@ fn new_unique_id(mut ids: Vec<String>) -> String {
let mut new_id: u64 = 0; let mut new_id: u64 = 0;
for id in ids { while ids.contains(&new_id.to_base36()) {
let id= from_base36(&id);
if id.is_ok() {
if new_id != id.unwrap() {
break;
}
new_id += 1; new_id += 1;
} }
}
return to_base36(new_id); return to_base36(new_id);
} }