Skip to content

Commit 6b66749

Browse files
committed
Use slice::split_first instead of manuall slicing
1 parent c5a96fb commit 6b66749

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/std/src/net/ip.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1610,9 +1610,9 @@ impl fmt::Display for Ipv6Addr {
16101610
/// Write a colon-separated part of the address
16111611
#[inline]
16121612
fn fmt_subslice(f: &mut fmt::Formatter<'_>, chunk: &[u16]) -> fmt::Result {
1613-
if let Some(first) = chunk.first() {
1613+
if let Some((first, tail)) = chunk.split_first() {
16141614
fmt::LowerHex::fmt(first, f)?;
1615-
for segment in &chunk[1..] {
1615+
for segment in tail {
16161616
f.write_char(':')?;
16171617
fmt::LowerHex::fmt(segment, f)?;
16181618
}

0 commit comments

Comments
 (0)