Skip to content

chore: fix clippy lints - #5082

Draft
xtqqczze wants to merge 2 commits into
rust-lang:mainfrom
xtqqczze:fix-clippy
Draft

chore: fix clippy lints#5082
xtqqczze wants to merge 2 commits into
rust-lang:mainfrom
xtqqczze:fix-clippy

Conversation

@xtqqczze

Copy link
Copy Markdown
Contributor

Assisted-by: clippy 0.1.97 (36ba2c7712 2026-04-23)

@xtqqczze
xtqqczze force-pushed the fix-clippy branch 3 times, most recently from 0d679e0 to 78a92b1 Compare April 26, 2026 22:20
@xtqqczze

Copy link
Copy Markdown
Contributor Author

@tgross35 These are all existing violations. Ideally we should run clippy in CI for every target.

@xtqqczze
xtqqczze marked this pull request as ready for review April 26, 2026 23:07
@rustbot

rustbot commented Apr 26, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in an Android module

cc @maurer

Some changes occurred in a solarish module

cc @jclulow, @pfmooney

Some changes occurred in a NetBSD-like module

cc @semarie

Comment thread src/unix/linux_like/linux/musl/lfs64.rs Outdated
Comment thread src/unix/bsd/netbsdlike/netbsd/mod.rs Outdated
@xtqqczze
xtqqczze marked this pull request as draft April 27, 2026 01:22
@xtqqczze
xtqqczze force-pushed the fix-clippy branch 3 times, most recently from 5a53eb1 to 3b47a2b Compare April 27, 2026 01:38
@xtqqczze
xtqqczze marked this pull request as ready for review April 27, 2026 01:59
@rustbot

rustbot commented Apr 27, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in an OpenBSD module

cc @semarie

Comment thread src/fuchsia/mod.rs Outdated
@xtqqczze
xtqqczze marked this pull request as draft April 27, 2026 02:47
@tgross35

tgross35 commented Apr 27, 2026 via email

Copy link
Copy Markdown
Contributor

@rustbot

This comment has been minimized.

@xtqqczze

Copy link
Copy Markdown
Contributor Author

@rustbot

This comment has been minimized.

Comment thread src/unix/hurd/mod.rs
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;

@ada4a ada4a Jul 12, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/unix/nto/mod.rs
} else {
true
}
!(sz > rsz || sz + (*_x).d_datalen as usize > rsz)

@ada4a ada4a Jul 12, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be simplified further by using De Morgan:

  1. !(sz > rsz || sz + (*_x).d_datalen as usize > rsz)
  2. !(sz > rz) && !(sz + (*_x).d_datalen as usize > rsz)
  3. 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

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'll just go with:

sz <= rsz && sz + (*_x).d_datalen as usize <= rsz

@xtqqczze

xtqqczze commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

unused_unit changes split to:

@rustbot rustbot added the ctest Issues relating to the ctest crate label Jul 24, 2026
Assisted-by: clippy 0.1.97 (36ba2c7712 2026-04-23)
@xtqqczze

Copy link
Copy Markdown
Contributor Author

explicit_iter_loop changes split to:

@rustbot

rustbot commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (possibly #5242) made this pull request unmergeable. Please resolve the merge conflicts.

@xtqqczze

xtqqczze commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

manual_bits changes split to:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants