diff options
| author | Igor Aleksanov <popzxc@yandex.ru> | 2020-01-07 10:35:16 +0300 |
|---|---|---|
| committer | Igor Aleksanov <popzxc@yandex.ru> | 2020-01-08 07:10:28 +0300 |
| commit | f720469fd0c4dff6d92e2f778ea2f252f76dcc2e (patch) | |
| tree | eed0768e1946a78b266025d661016f190795d871 /src/libstd/net/ip.rs | |
| parent | aa0769b92e60f5298f0b6326b8654c9b04351b98 (diff) | |
| download | rust-f720469fd0c4dff6d92e2f778ea2f252f76dcc2e.tar.gz rust-f720469fd0c4dff6d92e2f778ea2f252f76dcc2e.zip | |
Use matches macro in libcore and libstd
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(_)) } } |
