Skip to content

[ci] Deny let _ = on Result expressions #131

@intendednull

Description

@intendednull

Parent: #108

Problem

The silent-error pattern let _ = some_result_returning_call(); is endemic across the workspace:

  • crates/app/src/network_bridge.rs — ~15+ sites
  • crates/relay/src/main.rs — read/write I/O errors swallowed
  • crates/client/src/mutations.rs — broadcast failures swallowed
  • crates/client/src/listeners.rs — send failures swallowed

Some of these are intentional (unbounded mpsc channels that only fail on shutdown). Many are not. Several of the bugs uncovered in the review trace back to this pattern. Code reviewers have trouble telling "intentional" from "oops" because the syntax is identical.

Fix

  1. Enable the clippy::let_underscore_must_use lint at deny level workspace-wide:

    # Cargo.toml workspace lints
    [workspace.lints.clippy]
    let_underscore_must_use = "deny"
  2. For each existing violation, decide:

    • Keep silent: add drop(result) and a comment explaining why, or replace with .ok() on the Result.
    • Log a warning: replace with if let Err(e) = ... { warn!(...) }.
    • Propagate: add ?.
  3. Run just check to find the existing violation set and drive it to zero over one or two PRs.

Notes

  • Consider also enabling clippy::unused_result_ok (if available) which catches .ok(); at statement position.
  • This is not the same as #[must_use]. Many Willow functions already return Result; the lint catches accidental let _ = on those.
  • Don't set this globally until existing violations are fixed. This issue's implementation is:
    1. Drive existing violations to zero in the critical-path crates first (relay, client, state, crypto).
    2. Then flip the lint.

Test

Running just check after the lint is enabled should pass. The CI workflow in .github/workflows/ should already run just check — verify.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions