diff options
Diffstat (limited to 'src/libstd/net/ip.rs')
| -rw-r--r-- | src/libstd/net/ip.rs | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs index 15d2361acd9..6410a4f2b65 100644 --- a/src/libstd/net/ip.rs +++ b/src/libstd/net/ip.rs @@ -281,10 +281,7 @@ impl IpAddr { /// ``` #[stable(feature = "ipaddr_checker", since = "1.16.0")] pub fn is_ipv4(&self) -> bool { - match self { - IpAddr::V4(_) => true, - IpAddr::V6(_) => false, - } + matches!(self, IpAddr::V4(_)) } /// Returns [`true`] if this address is an [IPv6 address], and [`false`] otherwise. @@ -303,10 +300,7 @@ impl IpAddr { /// ``` #[stable(feature = "ipaddr_checker", since = "1.16.0")] pub fn is_ipv6(&self) -> bool { - match self { - IpAddr::V4(_) => false, - IpAddr::V6(_) => true, - } + matches!(self, IpAddr::V6(_)) } } |
