Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[net] apply clippy lints #77923

Merged
merged 6 commits into from
Oct 20, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion library/std/src/net/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,6 @@ impl SocketAddrV6 {
sin6_addr: *ip.as_inner(),
sin6_flowinfo: flowinfo,
sin6_scope_id: scope_id,
..unsafe { mem::zeroed() }
wcampbell0x2a marked this conversation as resolved.
Show resolved Hide resolved
},
}
}
Expand Down
13 changes: 5 additions & 8 deletions library/std/src/net/ip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,10 +456,7 @@ impl Ipv4Addr {
#[rustc_const_unstable(feature = "const_ipv4", issue = "76205")]
#[stable(since = "1.7.0", feature = "ip_17")]
pub const fn is_link_local(&self) -> bool {
match self.octets() {
[169, 254, ..] => true,
_ => false,
}
matches!(self.octets(), [169, 254, ..])
}

/// Returns [`true`] if the address appears to be globally routable.
Expand Down Expand Up @@ -1262,10 +1259,10 @@ impl Ipv6Addr {
/// [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] & 0xffff) == 0xfe80
&& (self.segments()[1] & 0xffff) == 0
&& (self.segments()[2] & 0xffff) == 0
&& (self.segments()[3] & 0xffff) == 0
(self.segments()[0]) == 0xfe80
&& self.segments()[1] == 0
&& self.segments()[2] == 0
&& self.segments()[3] == 0
wcampbell0x2a marked this conversation as resolved.
Show resolved Hide resolved
}

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