Skip to content

Commit 7da0e58

Browse files
use matches! in library/std/src/net/ip.rs
Apply suggestion from review Co-authored-by: LingMan <[email protected]>
1 parent 7a75f44 commit 7da0e58

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

library/std/src/net/ip.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,10 +1259,7 @@ impl Ipv6Addr {
12591259
/// [RFC 4291 errata 4406]: https://www.rfc-editor.org/errata/eid4406
12601260
#[rustc_const_unstable(feature = "const_ipv6", issue = "76205")]
12611261
pub const fn is_unicast_link_local_strict(&self) -> bool {
1262-
(self.segments()[0]) == 0xfe80
1263-
&& self.segments()[1] == 0
1264-
&& self.segments()[2] == 0
1265-
&& self.segments()[3] == 0
1262+
matches!(self.segments(), [0xfe80, 0, 0, 0, ..])
12661263
}
12671264

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

0 commit comments

Comments
 (0)