diff --git a/library/std/src/net/ip.rs b/library/std/src/net/ip.rs index d33b772633d..5c62ce43afb 100644 --- a/library/std/src/net/ip.rs +++ b/library/std/src/net/ip.rs @@ -1610,9 +1610,9 @@ struct Span { /// Write a colon-separated part of the address #[inline] fn fmt_subslice(f: &mut fmt::Formatter<'_>, chunk: &[u16]) -> fmt::Result { - if let Some(first) = chunk.first() { + if let Some((first, tail)) = chunk.split_first() { fmt::LowerHex::fmt(first, f)?; - for segment in &chunk[1..] { + for segment in tail { f.write_char(':')?; fmt::LowerHex::fmt(segment, f)?; }