about summary refs log tree commit diff
path: root/library/std/src/net
diff options
context:
space:
mode:
authorwcampbell <wcampbell1995@gmail.com>2020-10-13 19:33:39 -0400
committerGitHub <noreply@github.com>2020-10-13 19:33:39 -0400
commit7da0e58da4f1a4a7f102eb5478dbd4e7fa7edbaf (patch)
treefcba321c1577ef37d48cad163d446e109b51a2dd /library/std/src/net
parent7a75f4418313da0173192ed4d2f198e505e11428 (diff)
downloadrust-7da0e58da4f1a4a7f102eb5478dbd4e7fa7edbaf.tar.gz
rust-7da0e58da4f1a4a7f102eb5478dbd4e7fa7edbaf.zip
use matches! in library/std/src/net/ip.rs
Apply suggestion from review

Co-authored-by: LingMan <LingMan@users.noreply.github.com>
Diffstat (limited to 'library/std/src/net')
-rw-r--r--library/std/src/net/ip.rs5
1 files changed, 1 insertions, 4 deletions
diff --git a/library/std/src/net/ip.rs b/library/std/src/net/ip.rs
index 6bf71d28bb6..eb054b08117 100644
--- a/library/std/src/net/ip.rs
+++ b/library/std/src/net/ip.rs
@@ -1259,10 +1259,7 @@ impl Ipv6Addr {
     /// [RFC 4291 errata 4406]: https://www.rfc-editor.org/errata/eid4406
     #[rustc_const_unstable(feature = "const_ipv6", issue = "76205")]
     pub const fn is_unicast_link_local_strict(&self) -> bool {
-        (self.segments()[0]) == 0xfe80
-            && self.segments()[1] == 0
-            && self.segments()[2] == 0
-            && self.segments()[3] == 0
+       matches!(self.segments(), [0xfe80, 0, 0, 0, ..])
     }
 
     /// Returns [`true`] if the address is a unicast link-local address (`fe80::/10`).