We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fc164df commit 697744dCopy full SHA for 697744d
qlty-check/src/utils.rs
@@ -1,11 +1,11 @@
1
-use getrandom::getrandom;
+use rand::rngs::OsRng;
2
3
pub fn generate_random_id(length: usize) -> String {
4
// Use a URL/filename-safe alphabet to avoid control chars, path separators, etc.
5
const ALPHABET: &[u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZ\nabcdefghijklmnopqrstuvwxyz\n0123456789-_";
6
7
let mut buf = vec![0u8; length];
8
- getrandom(&mut buf).expect("Failed to generate random ID");
+ getrandom(&mut buf)?;
9
10
let mut id = String::with_capacity(length);
11
for byte in buf {
0 commit comments