Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
rootulp committed Jan 10, 2025
1 parent ede62b2 commit 1e654e9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions rust/nucleotide-count/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::collections::{HashMap, HashSet};
use std::collections::HashMap;

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

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

0 comments on commit 1e654e9

Please sign in to comment.