Use slice::split_first instead of manuall slicing
This commit is contained in:
parent
c5a96fb797
commit
6b66749e17
@ -1610,9 +1610,9 @@ struct Span {
|
|||||||
/// Write a colon-separated part of the address
|
/// Write a colon-separated part of the address
|
||||||
#[inline]
|
#[inline]
|
||||||
fn fmt_subslice(f: &mut fmt::Formatter<'_>, chunk: &[u16]) -> fmt::Result {
|
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)?;
|
fmt::LowerHex::fmt(first, f)?;
|
||||||
for segment in &chunk[1..] {
|
for segment in tail {
|
||||||
f.write_char(':')?;
|
f.write_char(':')?;
|
||||||
fmt::LowerHex::fmt(segment, f)?;
|
fmt::LowerHex::fmt(segment, f)?;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user