Skip to content

Commit 6df79bf

Browse files
authored
Rollup merge of #77923 - wcampbell0x2a:cleanup-net-module, r=scottmcm
[net] apply clippy lints Applied helpful clippy lints to the network std library module.
2 parents f9db008 + 736c27e commit 6df79bf

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

library/std/src/net/ip.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -456,10 +456,7 @@ impl Ipv4Addr {
456456
#[rustc_const_unstable(feature = "const_ipv4", issue = "76205")]
457457
#[stable(since = "1.7.0", feature = "ip_17")]
458458
pub const fn is_link_local(&self) -> bool {
459-
match self.octets() {
460-
[169, 254, ..] => true,
461-
_ => false,
462-
}
459+
matches!(self.octets(), [169, 254, ..])
463460
}
464461

465462
/// Returns [`true`] if the address appears to be globally routable.
@@ -1262,10 +1259,7 @@ impl Ipv6Addr {
12621259
/// [RFC 4291 errata 4406]: https://www.rfc-editor.org/errata/eid4406
12631260
#[rustc_const_unstable(feature = "const_ipv6", issue = "76205")]
12641261
pub const fn is_unicast_link_local_strict(&self) -> bool {
1265-
(self.segments()[0] & 0xffff) == 0xfe80
1266-
&& (self.segments()[1] & 0xffff) == 0
1267-
&& (self.segments()[2] & 0xffff) == 0
1268-
&& (self.segments()[3] & 0xffff) == 0
1262+
matches!(self.segments(), [0xfe80, 0, 0, 0, ..])
12691263
}
12701264

12711265
/// Returns [`true`] if the address is a unicast link-local address (`fe80::/10`).

0 commit comments

Comments
 (0)