Skip to content

Commit

Permalink
gnrc: Refactor Address to use an existing safe wrapper
Browse files Browse the repository at this point in the history
Merges: #56
  • Loading branch information
chrysn authored May 24, 2023
2 parents 80685c8 + 0ecf87e commit 234ec3f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/gnrc/ipv6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ impl ::core::str::FromStr for Address {
// When no_std_net / embedded_nal is present, it may be a good idea to run through there.
impl ::core::fmt::Debug for Address {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
let as_u8 = unsafe { &self.inner.u8_ };
let as_u8 = self.raw();
write!(
f,
"{:02x}{:02x}:{:02x}{:02x}:{:02x}{:02x}:{:02x}{:02x}:{:02x}{:02x}:{:02x}{:02x}:\
Expand Down Expand Up @@ -180,7 +180,7 @@ impl From<embedded_nal::Ipv6Addr> for Address {
#[cfg(feature = "with_embedded_nal")]
impl From<Address> for embedded_nal::Ipv6Addr {
fn from(addr: Address) -> Self {
Self::from(unsafe { addr.inner.u8_ })
Self::from(self.raw())
}
}

Expand Down

0 comments on commit 234ec3f

Please sign in to comment.