Skip to content

Commit a3fc02d

Browse files
committed
use matches!() macro in more places
1 parent 8f6f0be commit a3fc02d

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

std/src/net/ip.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -878,12 +878,7 @@ impl Ipv4Addr {
878878
#[must_use]
879879
#[inline]
880880
pub const fn is_documentation(&self) -> bool {
881-
match self.octets() {
882-
[192, 0, 2, _] => true,
883-
[198, 51, 100, _] => true,
884-
[203, 0, 113, _] => true,
885-
_ => false,
886-
}
881+
matches!(self.octets(), [192, 0, 2, _] | [198, 51, 100, _] | [203, 0, 113, _])
887882
}
888883

889884
/// Converts this address to an [IPv4-compatible] [`IPv6` address].

std/src/os/unix/net/addr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ impl SocketAddr {
159159
#[must_use]
160160
#[stable(feature = "unix_socket", since = "1.10.0")]
161161
pub fn is_unnamed(&self) -> bool {
162-
if let AddressKind::Unnamed = self.address() { true } else { false }
162+
matches!(self.address(), AddressKind::Unnamed)
163163
}
164164

165165
/// Returns the contents of this address if it is a `pathname` address.

0 commit comments

Comments
 (0)