Skip to content

Commit d45a703

Browse files
committed
Simplify is_broadcast
1 parent 7167a06 commit d45a703

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/libstd/net/ip.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -587,8 +587,7 @@ impl Ipv4Addr {
587587
/// ```
588588
#[stable(since = "1.7.0", feature = "ip_17")]
589589
pub fn is_broadcast(&self) -> bool {
590-
self.octets()[0] == 255 && self.octets()[1] == 255 &&
591-
self.octets()[2] == 255 && self.octets()[3] == 255
590+
self == &Self::BROADCAST
592591
}
593592

594593
/// Returns [`true`] if this address is in a range designated for documentation.

0 commit comments

Comments
 (0)