[net] clippy: match_like_matches_macro

warning: match expression looks like `matches!` macro
   --> library/std/src/net/ip.rs:459:9
    |
459 | /         match self.octets() {
460 | |             [169, 254, ..] => true,
461 | |             _ => false,
462 | |         }
    | |_________^ help: try this: `matches!(self.octets(), [169, 254,
..])`
    |
    = note: `#[warn(clippy::match_like_matches_macro)]` on by default
    = help: for further information visit
https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro

Signed-off-by: wcampbell <wcampbell1995@gmail.com>
This commit is contained in:
wcampbell 2020-10-13 18:00:59 -04:00
parent 058699d0a2
commit e6dc604e8b
No known key found for this signature in database
GPG key ID: A040F4DAFC68FFE8

View file

@ -456,10 +456,7 @@ impl Ipv4Addr {
#[rustc_const_unstable(feature = "const_ipv4", issue = "76205")] #[rustc_const_unstable(feature = "const_ipv4", issue = "76205")]
#[stable(since = "1.7.0", feature = "ip_17")] #[stable(since = "1.7.0", feature = "ip_17")]
pub const fn is_link_local(&self) -> bool { pub const fn is_link_local(&self) -> bool {
match self.octets() { matches!(self.octets(), [169, 254, ..])
[169, 254, ..] => true,
_ => false,
}
} }
/// Returns [`true`] if the address appears to be globally routable. /// Returns [`true`] if the address appears to be globally routable.