refactor new_unique_id()
This commit is contained in:
parent
5f736cc653
commit
6689fe1e1f
11
src/lib.rs
11
src/lib.rs
|
@ -171,15 +171,8 @@ 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);
|
new_id += 1;
|
||||||
if id.is_ok() {
|
|
||||||
if new_id != id.unwrap() {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
new_id += 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return to_base36(new_id);
|
return to_base36(new_id);
|
||||||
|
|
Loading…
Reference in New Issue