Simplify is_broadcast · rust-lang/rust@312cdb4 (original) (raw)
Navigation Menu
- GitHub Copilot Write better code with AI
- GitHub Models New Manage and compare prompts
- GitHub Advanced Security Find and fix vulnerabilities
- Actions Automate any workflow
- Codespaces Instant dev environments
- Issues Plan and track work
- Code Review Manage code changes
- Discussions Collaborate outside of code
- Code Search Find more, search less
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Commit 312cdb4
File tree
1 file changed
lines changed
1 file changed
lines changed
Lines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -587,8 +587,7 @@ impl Ipv4Addr { | ||
587 | 587 | /// ``` |
588 | 588 | #[stable(since = "1.7.0", feature = "ip_17")] |
589 | 589 | 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 | |
592 | 591 | } |
593 | 592 | |
594 | 593 | /// Returns [`true`] if this address is in a range designated for documentation. |