From 462c9326a0650e84a5500b852ac20157e7b56a01 Mon Sep 17 00:00:00 2001 From: Maximilian Date: Sun, 3 Nov 2024 19:41:48 -0600 Subject: [PATCH] Use string primitive to avoid a heap allocation --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index ff056dd..8b84982 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,7 +21,7 @@ fn main() { // Disallowed_chars is an optional argument 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 = allowed_chars.chars().collect();