about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLzu Tao <taolzu@gmail.com>2021-01-20 01:33:38 +0000
committerLzu Tao <taolzu@gmail.com>2021-01-20 04:31:34 +0000
commit6b66749e171e8a9c6718c0107f4ec2e3f47b28ed (patch)
tree67a3a302ed66b98d7d5d0bc1b9b1fca40d118c8e
parentc5a96fb7973649807a7943e7395456db158dcab6 (diff)
downloadrust-6b66749e171e8a9c6718c0107f4ec2e3f47b28ed.tar.gz
rust-6b66749e171e8a9c6718c0107f4ec2e3f47b28ed.zip
Use slice::split_first instead of manuall slicing
-rw-r--r--library/std/src/net/ip.rs4
1 files changed, 2 insertions, 2 deletions
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 @@ impl fmt::Display for Ipv6Addr {
                 /// 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)?;
                         }