Use string primitive to avoid a heap allocation
This commit is contained in:
parent
8edc65ff4b
commit
462c9326a0
@ -21,7 +21,7 @@ fn main() {
|
|||||||
// Disallowed_chars is an optional argument
|
// Disallowed_chars is an optional argument
|
||||||
let disallowed_chars: Option<&String> = args.get(2);
|
let disallowed_chars: Option<&String> = args.get(2);
|
||||||
|
|
||||||
let allowed_chars: String = String::from("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-=`~!@#$%^&*()_+[]\\{}|;':,./<>?");
|
let allowed_chars: &str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-=`~!@#$%^&*()_+[]\\{}|;':,./<>?";
|
||||||
|
|
||||||
let mut allowed_chars_set: HashSet<char> = allowed_chars.chars().collect();
|
let mut allowed_chars_set: HashSet<char> = allowed_chars.chars().collect();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user