chore: fix clippy lints - #5082
Conversation
0d679e0 to
78a92b1
Compare
|
@tgross35 These are all existing violations. Ideally we should run clippy in CI for every target. |
5a53eb1 to
3b47a2b
Compare
|
Some changes occurred in an OpenBSD module cc @semarie |
|
I think enabling it here would be reasonable 👍
(edit: well, I guess the email UI has no context about what's in a discussion, ignore this one)
|
This comment has been minimized.
This comment has been minimized.
|
@tgross35 I would like to merge these first: |
This comment has been minimized.
This comment has been minimized.
| pub const S_IROOT: mode_t = 0o4000_0000; | ||
| pub const S_ITRANS: mode_t = 0o7000_0000; | ||
| pub const S_IMMAP0: mode_t = 0o10000_0000; | ||
| pub const S_IMMAP0: mode_t = 0o1_0000_0000; |
There was a problem hiding this comment.
I'd leave this one as is, for symmetry with the previous ones. I think the logic of rust-lang/rust-clippy#11749 applies here
There was a problem hiding this comment.
On the contrary, I’d keep the additional spacing here for consistency with the previous constants. All of the digits are grouped in sets of four.
| } else { | ||
| true | ||
| } | ||
| !(sz > rsz || sz + (*_x).d_datalen as usize > rsz) |
There was a problem hiding this comment.
I think this can be simplified further by using De Morgan:
!(sz > rsz || sz + (*_x).d_datalen as usize > rsz)!(sz > rz) && !(sz + (*_x).d_datalen as usize > rsz)sz <= rz && sz + (*_x).d_datalen as usize <= rsz
...which, it looks like, could even be simplified all the way down to
sz + (*_x).d_datalen as usize <= rsz
as sz <= sz + (*_x).d_datalen as usize. Or this could be relying on wrapping somehow? But in that case that would be good to make explicit using .wrapping_add(). Not sure, not a domain expert by any means
There was a problem hiding this comment.
I think I'll just go with:
sz <= rsz && sz + (*_x).d_datalen as usize <= rsz
|
|
Assisted-by: clippy 0.1.97 (36ba2c7712 2026-04-23)
|
|
|
☔ The latest upstream changes (possibly #5242) made this pull request unmergeable. Please resolve the merge conflicts. |
|
|
Assisted-by: clippy 0.1.97 (36ba2c7712 2026-04-23)