Fix R-I26: turn host_actuator.rs's never_loop into a real if, restore --all-targets
The answerer thread's `while let Some(frame) = client.receive_once()? { ...;
return Ok(()); }` always returns on its first (and only reachable) iteration,
so clippy::never_loop was right that it never loops -- the outer `for` is
what actually retries across polls. Rewritten as `if let`.
With that gone, cargo clippy --all-targets has nothing left to scope the
lint workflow around, so .github/workflows/lint.yml runs it again. Test
code is exactly where a disallowed_methods bypass would hide, and it was
the one place the workflow's own lint couldn't reach.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
75153b09b1
commit
1f68cff9a5
2 changed files with 13 additions and 11 deletions
18
.github/workflows/lint.yml
vendored
18
.github/workflows/lint.yml
vendored
|
|
@ -13,19 +13,17 @@ jobs:
|
|||
# `FrozenSymlinkFs` port (see `src/drivers.rs`, `frozen_symlink_port`)
|
||||
# if something actually runs clippy with the lint promoted to an error.
|
||||
#
|
||||
# No `--all-targets`: measured on Yggdrasil against this batch and
|
||||
# against a46b997 (its parent, before this batch touched anything) --
|
||||
# `cargo clippy --all-targets` already fails on a pre-existing,
|
||||
# unrelated `clippy::never_loop` in `host_actuator.rs`'s own test code,
|
||||
# nothing this batch introduced or is chartered to fix. Without
|
||||
# `--all-targets`, clippy still analyzes the library crate itself,
|
||||
# which is where `frozen_symlink_port` and every other disallowed-method
|
||||
# call site actually live, so the port's coverage is unaffected; only
|
||||
# test-only code outside the lib is left unchecked by this job.
|
||||
# R-I26 (Self's ruling, migration-hazard follow-up): the pre-existing
|
||||
# `clippy::never_loop` this batch's parent scoped the workflow around is
|
||||
# fixed (`host_actuator.rs`'s answerer thread used a `while let` whose
|
||||
# every path returned; it is an `if let` now, since the outer `for` was
|
||||
# already what retried across polls). Test code is exactly where a
|
||||
# `disallowed_methods` bypass would hide, so `--all-targets` is back:
|
||||
# this job now reaches it too, not just the library crate.
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
components: clippy
|
||||
- run: cargo clippy --all-features -- -D clippy::disallowed_methods
|
||||
- run: cargo clippy --all-targets --all-features -- -D clippy::disallowed_methods
|
||||
|
|
|
|||
|
|
@ -1108,7 +1108,11 @@ mod tests {
|
|||
let answerer = thread::spawn(move || -> Result<()> {
|
||||
for _ in 0..500 {
|
||||
client.poll_resends()?;
|
||||
while let Some(frame) = client.receive_once()? {
|
||||
// A plain `if let`, not `while`: every path through this body
|
||||
// returns, so a loop here would never run a second iteration
|
||||
// (`clippy::never_loop`) -- the outer `for` is what retries
|
||||
// across polls.
|
||||
if let Some(frame) = client.receive_once()? {
|
||||
let envelope = HostActuatorEnvelope::decode(&frame.payload)?;
|
||||
let request = envelope.open_request("raven", &idunn_anchor)?;
|
||||
assert_eq!(envelope.session_nonce, nonce);
|
||||
|
|
|
|||
Loading…
Reference in a new issue