Skip to content

Commit

Permalink
Switch from (...).into() to Self(...)
Browse files Browse the repository at this point in the history
Although it introduces some nesting, I think it's an overall improvement to clarity.
  • Loading branch information
swooster committed Oct 17, 2023
1 parent fc86358 commit 7326a98
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/nucleotide.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ impl CodonAmbiguous {
impl From<Codon> for CodonAmbiguous {
#[inline(always)]
fn from(codon: Codon) -> Self {
codon.0.map(Into::into).into()
Self(codon.0.map(Into::into))
}
}

Expand All @@ -448,7 +448,7 @@ impl TryFrom<CodonAmbiguous> for Codon {
#[inline(always)]
fn try_from(codon: CodonAmbiguous) -> Result<Self, Self::Error> {
let [nuc0, nuc1, nuc2] = codon.0.map(TryInto::try_into);
Ok([nuc0?, nuc1?, nuc2?].into())
Ok(Self([nuc0?, nuc1?, nuc2?]))
}
}

Expand Down

0 comments on commit 7326a98

Please sign in to comment.