about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-10-20 12:11:04 +0900
committerGitHub <noreply@github.com>2020-10-20 12:11:04 +0900
commit6df79bf8a8e32c68fd226888c27a989f2b0f55cf (patch)
tree7303ef046dc767c4aa7a0c0564aa3b4fd9762991
parentf9db00839efb1fedf48dbabbab3e0779ff2d8d5e (diff)
parent736c27ec0b2cd8c79fedd66e5487b47b8746b7c0 (diff)
downloadrust-6df79bf8a8e32c68fd226888c27a989f2b0f55cf.tar.gz
rust-6df79bf8a8e32c68fd226888c27a989f2b0f55cf.zip
Rollup merge of #77923 - wcampbell0x2a:cleanup-net-module, r=scottmcm
[net] apply clippy lints

Applied helpful clippy lints to the network std library module.
-rw-r--r--library/std/src/net/ip.rs10
1 files changed, 2 insertions, 8 deletions
diff --git a/library/std/src/net/ip.rs b/library/std/src/net/ip.rs
index f01a7b72a65..8089d7a8ba6 100644
--- a/library/std/src/net/ip.rs
+++ b/library/std/src/net/ip.rs
@@ -456,10 +456,7 @@ impl Ipv4Addr {
     #[rustc_const_unstable(feature = "const_ipv4", issue = "76205")]
     #[stable(since = "1.7.0", feature = "ip_17")]
     pub const fn is_link_local(&self) -> bool {
-        match self.octets() {
-            [169, 254, ..] => true,
-            _ => false,
-        }
+        matches!(self.octets(), [169, 254, ..])
     }
 
     /// Returns [`true`] if the address appears to be globally routable.
@@ -1262,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] & 0xffff) == 0xfe80
-            && (self.segments()[1] & 0xffff) == 0
-            && (self.segments()[2] & 0xffff) == 0
-            && (self.segments()[3] & 0xffff) == 0
+        matches!(self.segments(), [0xfe80, 0, 0, 0, ..])
     }
 
     /// Returns [`true`] if the address is a unicast link-local address (`fe80::/10`).