From 312cdb4233511ef9c8af6e4803bc01e45dab2907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20F=C3=A4rnstrand?= Date: Sun, 29 Jul 2018 22:35:31 +0200 Subject: [PATCH] Simplify is_broadcast --- src/libstd/net/ip.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs index 2f3994365e0bd..341757aeb75a5 100644 --- a/src/libstd/net/ip.rs +++ b/src/libstd/net/ip.rs @@ -587,8 +587,7 @@ impl Ipv4Addr { /// ``` #[stable(since = "1.7.0", feature = "ip_17")] pub fn is_broadcast(&self) -> bool { - self.octets()[0] == 255 && self.octets()[1] == 255 && - self.octets()[2] == 255 && self.octets()[3] == 255 + self == &Self::BROADCAST } /// Returns [`true`] if this address is in a range designated for documentation.