Skip to content

refactor: add #[must_use] to public Result/Option functions (#2123) - #4004

Merged
oferchen merged 6 commits into
masterfrom
refactor/must-use-audit-2123
May 13, 2026
Merged

oferchen merged 6 commits into
masterfrom
refactor/must-use-audit-2123

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Add #[must_use] annotations to ~105 public functions returning Result or Option across 6 core crates: checksums, protocol, engine, transfer, filters, and signature
  • Targets constructors, parsers, decoders, accessors, and factory functions where silently ignoring the return value is almost certainly a bug
  • Skips side-effecting I/O writes and mutation methods where the function is called for its effect

Crate breakdown

Crate Files Annotations
checksums 7 11
protocol 19 38
engine 4 5
transfer 17 34
filters 3 5
signature 2 3

Selection criteria

Added to: from_* constructors, parse/decode functions, read_* deserializers, open/new factories, pure getters returning Option, build() methods, try_acquire/try_recv polling methods, iterator-like next_* methods.

Skipped: write_*/send_*/flush_* I/O methods (side-effecting), update_reader* (mutation + I/O), roll/roll_many (mutation returning Result for error signaling), private/crate-internal functions, trait method declarations, functions already annotated.

Test plan

  • CI fmt+clippy passes (annotation-only change, no logic modifications)
  • CI nextest passes on all platforms (Linux, macOS, Windows)
  • No new warnings introduced (bare #[must_use] does not produce unused_must_use unless callers actually discard the value)

Annotate ~100 public functions returning Result or Option across 6
core crates (checksums, protocol, engine, transfer, filters,
signature) with #[must_use] to catch silently-ignored return values
at compile time.

Focused on constructors, parsers, decoders, accessors, and factory
functions where ignoring the return value is almost certainly a bug.
Skipped side-effecting I/O writes and mutations where the function
is called for its effect rather than its return value.
oferchen added 5 commits May 13, 2026 23:05
Removes #[must_use] (no message) from public functions returning
Result<T, E> or Option<T> across the workspace. The standard library
already marks both types as #[must_use], so the function-level
annotation is redundant and triggers clippy's double_must_use lint
under -D warnings.

Also adds `let _ =` to test call sites that discard `PipelineState::pop()`
return values, since Option's inherent #[must_use] still flags them.
@oferchen
oferchen merged commit 122b506 into master May 13, 2026
38 of 39 checks passed
@oferchen
oferchen deleted the refactor/must-use-audit-2123 branch May 14, 2026 14:58
oferchen added a commit that referenced this pull request May 18, 2026
…4004)

* refactor: add #[must_use] to public Result/Option functions (#2123)

Annotate ~100 public functions returning Result or Option across 6
core crates (checksums, protocol, engine, transfer, filters,
signature) with #[must_use] to catch silently-ignored return values
at compile time.

Focused on constructors, parsers, decoders, accessors, and factory
functions where ignoring the return value is almost certainly a bug.
Skipped side-effecting I/O writes and mutations where the function
is called for its effect rather than its return value.

* fix: remove redundant #[must_use] on Result-returning functions

* fix: remove redundant #[must_use] from checksums Result/Option fns

* fix: remove redundant #[must_use] from signature async_gen

* fix: remove redundant #[must_use] and fix unused return values in engine

* fix: remove redundant #[must_use] from all Result/Option fns

Removes #[must_use] (no message) from public functions returning
Result<T, E> or Option<T> across the workspace. The standard library
already marks both types as #[must_use], so the function-level
annotation is redundant and triggers clippy's double_must_use lint
under -D warnings.

Also adds `let _ =` to test call sites that discard `PipelineState::pop()`
return values, since Option's inherent #[must_use] still flags them.
oferchen added a commit that referenced this pull request Jun 10, 2026
Adds a fourth IoUringPolicy variant (SqpollOff) wired to the new --no-io-uring-sqpoll flag. The variant keeps io_uring active for file and socket I/O but suppresses IORING_SETUP_SQPOLL via a process-wide gate that build_ring() and the session-pool ring builder consult. This gives operators a deterministic opt-out for rootless containers and Kubernetes pods that cannot grant CAP_SYS_NICE, instead of relying on the kernel's EPERM fallback path.

Adds docs/deployment/kubernetes.md covering Pod manifests for SQPOLL-enabled and SQPOLL-suppressed workloads, daemon-as-Pod deployment, Pod Security Admission profile interactions, and the tradeoff table. Extends docs/deployment/container-io-uring.md (IKV-F.6) with a K8s rootless-opt-out subsection and adds the new flag to docs/deployment/io-uring-feature-matrix.md.

Bundles SQP-K8S.1 / .3 / .4 (#4004 / #4006 / #4007). The rootless throughput bench (SQP-K8S.2) requires container access and is deferred to a follow-up PR.
oferchen added a commit that referenced this pull request Aug 24, 2026
…4004)

* refactor: add #[must_use] to public Result/Option functions (#2123)

Annotate ~100 public functions returning Result or Option across 6
core crates (checksums, protocol, engine, transfer, filters,
signature) with #[must_use] to catch silently-ignored return values
at compile time.

Focused on constructors, parsers, decoders, accessors, and factory
functions where ignoring the return value is almost certainly a bug.
Skipped side-effecting I/O writes and mutations where the function
is called for its effect rather than its return value.

* fix: remove redundant #[must_use] on Result-returning functions

* fix: remove redundant #[must_use] from checksums Result/Option fns

* fix: remove redundant #[must_use] from signature async_gen

* fix: remove redundant #[must_use] and fix unused return values in engine

* fix: remove redundant #[must_use] from all Result/Option fns

Removes #[must_use] (no message) from public functions returning
Result<T, E> or Option<T> across the workspace. The standard library
already marks both types as #[must_use], so the function-level
annotation is redundant and triggers clippy's double_must_use lint
under -D warnings.

Also adds `let _ =` to test call sites that discard `PipelineState::pop()`
return values, since Option's inherent #[must_use] still flags them.
oferchen added a commit that referenced this pull request Aug 24, 2026
…4004)

* refactor: add #[must_use] to public Result/Option functions (#2123)

Annotate ~100 public functions returning Result or Option across 6
core crates (checksums, protocol, engine, transfer, filters,
signature) with #[must_use] to catch silently-ignored return values
at compile time.

Focused on constructors, parsers, decoders, accessors, and factory
functions where ignoring the return value is almost certainly a bug.
Skipped side-effecting I/O writes and mutations where the function
is called for its effect rather than its return value.

* fix: remove redundant #[must_use] on Result-returning functions

* fix: remove redundant #[must_use] from checksums Result/Option fns

* fix: remove redundant #[must_use] from signature async_gen

* fix: remove redundant #[must_use] and fix unused return values in engine

* fix: remove redundant #[must_use] from all Result/Option fns

Removes #[must_use] (no message) from public functions returning
Result<T, E> or Option<T> across the workspace. The standard library
already marks both types as #[must_use], so the function-level
annotation is redundant and triggers clippy's double_must_use lint
under -D warnings.

Also adds `let _ =` to test call sites that discard `PipelineState::pop()`
return values, since Option's inherent #[must_use] still flags them.
oferchen added a commit that referenced this pull request Aug 24, 2026
Adds a fourth IoUringPolicy variant (SqpollOff) wired to the new --no-io-uring-sqpoll flag. The variant keeps io_uring active for file and socket I/O but suppresses IORING_SETUP_SQPOLL via a process-wide gate that build_ring() and the session-pool ring builder consult. This gives operators a deterministic opt-out for rootless containers and Kubernetes pods that cannot grant CAP_SYS_NICE, instead of relying on the kernel's EPERM fallback path.

Adds docs/deployment/kubernetes.md covering Pod manifests for SQPOLL-enabled and SQPOLL-suppressed workloads, daemon-as-Pod deployment, Pod Security Admission profile interactions, and the tradeoff table. Extends docs/deployment/container-io-uring.md (IKV-F.6) with a K8s rootless-opt-out subsection and adds the new flag to docs/deployment/io-uring-feature-matrix.md.

Bundles SQP-K8S.1 / .3 / .4 (#4004 / #4006 / #4007). The rootless throughput bench (SQP-K8S.2) requires container access and is deferred to a follow-up PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant