From 12b224355fda692d1a13ef76a84fb799a94fd991 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Neac=C8=99u=20Adrian?= <75613031+Adin3@users.noreply.github.com> Date: Sun, 21 Jan 2024 17:22:49 +0200 Subject: [PATCH] Update src/string/lipogram.rs Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com> --- src/string/lipogram.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/string/lipogram.rs b/src/string/lipogram.rs index b71d9ecf91f..90551d5b9f6 100644 --- a/src/string/lipogram.rs +++ b/src/string/lipogram.rs @@ -49,7 +49,11 @@ fn compute_missing(in_str: &str) -> HashSet { /// )); /// ``` pub fn is_lipogram(lipogram_str: &str, missing_chars: &HashSet) -> bool { - missing_chars == &compute_missing(&lipogram_str.to_lowercase()) + if !missing_chars.iter().all(|&c| c.is_lowercase()) { + panic!("missing_chars should be all lowercase.") + } + + missing_chars == &compute_missing(lipogram_str) } macro_rules! test_lipogram {