Skip to content

Commit 7a75f44

Browse files
committed
[net] clippy: identity_op
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>
1 parent e6dc604 commit 7a75f44

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

library/std/src/net/ip.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,10 +1259,10 @@ 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] & 0xffff) == 0xfe80
1263-
&& (self.segments()[1] & 0xffff) == 0
1264-
&& (self.segments()[2] & 0xffff) == 0
1265-
&& (self.segments()[3] & 0xffff) == 0
1262+
(self.segments()[0]) == 0xfe80
1263+
&& self.segments()[1] == 0
1264+
&& self.segments()[2] == 0
1265+
&& self.segments()[3] == 0
12661266
}
12671267

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

0 commit comments

Comments
 (0)