From: wcampbell Date: Tue, 13 Oct 2020 23:33:39 +0000 (-0400) Subject: use matches! in library/std/src/net/ip.rs X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=7da0e58da4f1a4a7f102eb5478dbd4e7fa7edbaf;p=rust.git use matches! in library/std/src/net/ip.rs Apply suggestion from review Co-authored-by: LingMan --- diff --git a/library/std/src/net/ip.rs b/library/std/src/net/ip.rs index 6bf71d28bb6..eb054b08117 100644 --- a/library/std/src/net/ip.rs +++ b/library/std/src/net/ip.rs @@ -1259,10 +1259,7 @@ pub const fn is_unique_local(&self) -> bool { /// [RFC 4291 errata 4406]: https://www.rfc-editor.org/errata/eid4406 #[rustc_const_unstable(feature = "const_ipv6", issue = "76205")] pub const fn is_unicast_link_local_strict(&self) -> bool { - (self.segments()[0]) == 0xfe80 - && self.segments()[1] == 0 - && self.segments()[2] == 0 - && self.segments()[3] == 0 + matches!(self.segments(), [0xfe80, 0, 0, 0, ..]) } /// Returns [`true`] if the address is a unicast link-local address (`fe80::/10`).