Skip to content

Commit

Permalink
Use fewer unwraps
Browse files Browse the repository at this point in the history
Co-authored-by: Ruben De Smet <[email protected]>
  • Loading branch information
direc85 and rubdos committed May 25, 2024
1 parent 741611d commit 6a1ef09
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libsignal-service/src/service_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ impl TryFrom<&[u8]> for ServiceAddress {
type Error = ParseServiceAddressError;

fn try_from(value: &[u8]) -> Result<Self, Self::Error> {
if value.starts_with(b"PNI:") {
if let Some(pni) = value.strip_prefix(b"PNI:") {
Ok(ServiceAddress {
uuid: Uuid::from_slice(value.strip_prefix(b"PNI:").unwrap())?,
uuid: Uuid::from_slice(pni)?,
identity: ServiceIdType::PhoneNumberIdentity,
})
} else {
Expand Down

0 comments on commit 6a1ef09

Please sign in to comment.