Skip to content

Commit 1e654e9

Browse files
committed
refactor
1 parent ede62b2 commit 1e654e9

File tree

1 file changed

+2
-3
lines changed
  • rust/nucleotide-count/src

1 file changed

+2
-3
lines changed

rust/nucleotide-count/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::collections::{HashMap, HashSet};
1+
use std::collections::HashMap;
22

33
pub fn count(nucleotide: char, dna: &str) -> Result<usize, char> {
44
if !valid_nucleotide(nucleotide) {
@@ -28,6 +28,5 @@ fn default_map() -> HashMap<char, usize> {
2828
}
2929

3030
fn valid_nucleotide(c: char) -> bool {
31-
let nucleotides = HashSet::from(['A', 'C', 'G', 'T']);
32-
nucleotides.contains(&c)
31+
matches!(c, 'A' | 'C' | 'G' | 'T')
3332
}

0 commit comments

Comments
 (0)