adapt to new version of rand crate
This commit is contained in:
parent
4e0a9818ad
commit
cb3e52c560
1 changed files with 3 additions and 3 deletions
|
|
@ -3,7 +3,7 @@ use std::fs::File;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::io::{ErrorKind, Write, BufRead, BufReader};
|
use std::io::{ErrorKind, Write, BufRead, BufReader};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use rand::distributions::{Alphanumeric, DistString};
|
use rand::distr::{Alphanumeric, SampleString};
|
||||||
|
|
||||||
const LOCK_FILE: &str = ".mvwrap";
|
const LOCK_FILE: &str = ".mvwrap";
|
||||||
|
|
||||||
|
|
@ -166,11 +166,11 @@ impl DirList {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_unique_entry(target_list: &DirList) -> String {
|
fn get_unique_entry(target_list: &DirList) -> String {
|
||||||
let mut string = Alphanumeric.sample_string(&mut rand::thread_rng(), 16);
|
let mut string = Alphanumeric.sample_string(&mut rand::rng(), 16);
|
||||||
|
|
||||||
// Generate unique name that does not exist in current dir and is not in target_list
|
// Generate unique name that does not exist in current dir and is not in target_list
|
||||||
while target_list.entries.iter().any(|j| j.to_string() == string) || Path::new(&string).is_file() {
|
while target_list.entries.iter().any(|j| j.to_string() == string) || Path::new(&string).is_file() {
|
||||||
string = Alphanumeric.sample_string(&mut rand::thread_rng(), 16);
|
string = Alphanumeric.sample_string(&mut rand::rng(), 16);
|
||||||
}
|
}
|
||||||
string
|
string
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue