Skip to content

Commit

Permalink
Remove format_u8 when not used by Ipv4Addr impl
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Mar 22, 2021
1 parent 9be4c96 commit 1bb23ad
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions serde/src/ser/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -674,13 +674,15 @@ impl Serialize for net::IpAddr {
}
}

#[cfg(feature = "std")]
const DEC_DIGITS_LUT: &'static [u8] = b"\
0001020304050607080910111213141516171819\
2021222324252627282930313233343536373839\
4041424344454647484950515253545556575859\
6061626364656667686970717273747576777879\
8081828384858687888990919293949596979899";

#[cfg(feature = "std")]
#[inline]
fn format_u8(mut n: u8, out: &mut [u8]) -> usize {
if n >= 100 {
Expand All @@ -701,6 +703,7 @@ fn format_u8(mut n: u8, out: &mut [u8]) -> usize {
}
}

#[cfg(feature = "std")]
#[test]
fn test_format_u8() {
for i in 0..(u8::MAX as u16) {
Expand Down

0 comments on commit 1bb23ad

Please sign in to comment.