Skip to content

Commit

Permalink
Update src/string/lipogram.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Piotr Idzik <[email protected]>
  • Loading branch information
Adin3 and vil02 authored Jan 21, 2024
1 parent 9ac2530 commit 12b2243
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/string/lipogram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ fn compute_missing(in_str: &str) -> HashSet<char> {
/// ));
/// ```
pub fn is_lipogram(lipogram_str: &str, missing_chars: &HashSet<char>) -> 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 {
Expand Down

0 comments on commit 12b2243

Please sign in to comment.