1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/// The blocklist pub const BLOCKLIST: [&'static str; 538] = include!("list.json"); /// Check if the word is in the blacklist, return false (validation failed), otherwise true. pub fn validate(s: &str) -> bool { !BLOCKLIST.contains(&s) } #[cfg(test)] mod tests { use super::*; #[test] fn is_valid_return_true() { assert!(validate("paperinik")); } #[test] fn is_valid_return_false() { assert!(!validate("root")); } }