Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

Commit

Permalink
Update slice to array conversion.
Browse files Browse the repository at this point in the history
  • Loading branch information
so-schen committed Dec 10, 2023
1 parent 99067d9 commit 53263fc
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,7 @@ impl<'de, const N: usize> Deserialize<'de> for [u8; N] {
return Err(E::invalid_length(v.len(), &self));
}

let mut arr = [0; N];
arr.copy_from_slice(v);
Ok(arr)
Ok(v.try_into().unwrap())
}

fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
Expand Down

0 comments on commit 53263fc

Please sign in to comment.