From 1e654e944d65cc4dd427093b1ce94babfd6852c3 Mon Sep 17 00:00:00 2001 From: Rootul Patel Date: Thu, 9 Jan 2025 22:24:07 -0500 Subject: [PATCH] refactor --- rust/nucleotide-count/src/lib.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/rust/nucleotide-count/src/lib.rs b/rust/nucleotide-count/src/lib.rs index d6f36aa9..76f8261b 100644 --- a/rust/nucleotide-count/src/lib.rs +++ b/rust/nucleotide-count/src/lib.rs @@ -1,4 +1,4 @@ -use std::collections::{HashMap, HashSet}; +use std::collections::HashMap; pub fn count(nucleotide: char, dna: &str) -> Result { if !valid_nucleotide(nucleotide) { @@ -28,6 +28,5 @@ fn default_map() -> HashMap { } fn valid_nucleotide(c: char) -> bool { - let nucleotides = HashSet::from(['A', 'C', 'G', 'T']); - nucleotides.contains(&c) + matches!(c, 'A' | 'C' | 'G' | 'T') }