Skip to content

Commit

Permalink
[net] clippy: identity_op
Browse files Browse the repository at this point in the history
warning: the operation is ineffective. Consider reducing it to
`self.segments()[0]`
    --> library/std/src/net/ip.rs:1265:9
     |
1265 |         (self.segments()[0] & 0xffff) == 0xfe80
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: `#[warn(clippy::identity_op)]` on by default
     = help: for further information visit
https://rust-lang.github.io/rust-clippy/master/index.html#identity_op

warning: the operation is ineffective. Consider reducing it to
`self.segments()[1]`
    --> library/std/src/net/ip.rs:1266:16
     |
1266 |             && (self.segments()[1] & 0xffff) == 0
     |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = help: for further information visit
https://rust-lang.github.io/rust-clippy/master/index.html#identity_op

warning: the operation is ineffective. Consider reducing it to
`self.segments()[2]`
    --> library/std/src/net/ip.rs:1267:16
     |
1267 |             && (self.segments()[2] & 0xffff) == 0
     |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = help: for further information visit
https://rust-lang.github.io/rust-clippy/master/index.html#identity_op

warning: the operation is ineffective. Consider reducing it to
`self.segments()[3]`
    --> library/std/src/net/ip.rs:1268:16
     |
1268 |             && (self.segments()[3] & 0xffff) == 0
     |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = help: for further information visit
https://rust-lang.github.io/rust-clippy/master/index.html#identity_op

Signed-off-by: wcampbell <wcampbell1995@gmail.com>
  • Loading branch information
wcampbell0x2a committed Oct 13, 2020
1 parent e6dc604 commit 7a75f44
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions library/std/src/net/ip.rs
Expand Up @@ -1259,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
}

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

0 comments on commit 7a75f44

Please sign in to comment.