Skip to content

Replace #[allow(...)] with narrowly scoped #[expect(..., reason = "...")] in test support modules #118

@coderabbitai

Description

@coderabbitai

Background

Test support code must be placed in scoped and cfg-guarded modules so that only the code needed by a given test compilation is included, rather than relying on broad lint suppressions.

Raised during review of PR #116 by @leynos.

Required changes

tests/support/mod.rs (around lines 362–385)

Replace the two forbidden #[allow(...)] attributes in the routines_symbol_refs function with narrowly scoped #[expect(..., reason = "...")] attributes:

  1. Change #[allow(dead_code)] above routines_symbol_refs to:

    #[expect(dead_code, reason = "compile-time symbol reference used for API stability checks in tests")]
  2. Change #[allow(clippy::type_complexity)] immediately before the complex const type assertion for routines::make_minimal_engine to:

    #[expect(clippy::type_complexity, reason = "explicit compile-time type assertion for RoutineEngine/Receiver tuple in tests")]

Keep attributes local to the function. Ensure attribute names and reasons reference the symbols involved (routines_symbol_refs, routines::create_workspace, routines::make_minimal_engine, routines::make_routine, routines::make_test_incoming_message) so the intent is clear.

tests/support/routines.rs (lines 7–8 and 27–43)

  1. Remove the crate-level #![allow(dead_code)] attribute (lines 7–8).

  2. Add #[expect(dead_code, reason = "used only in e2e_traces")] directly on the specific items (functions/structs/consts) that are only referenced by e2e_traces. If an item cannot be identified immediately, apply the expect attribute to the smallest enclosing module or individual item rather than a crate-wide attribute.

  3. Replace every remaining #[allow(dead_code)] occurrence (lines 27–43 and elsewhere) with a narrowly scoped:

    #[expect(dead_code, reason = "<meaningful justification for the specific symbol>")]

    Specifically update:

    • The struct and impl for SystemEventSpec (symbols: SystemEventSpec, new)
    • Every other occurrence at the noted lines

    Each attribute must be converted individually with a meaningful reason text for that symbol.

Acceptance criteria

  • No #[allow(dead_code)] or #[allow(clippy::...)] attributes remain in tests/support/mod.rs or tests/support/routines.rs.
  • All replacements use #[expect(..., reason = "...")] with a non-empty, symbol-specific reason string.
  • The #![allow(dead_code)] crate-level attribute is removed from tests/support/routines.rs.
  • Lint suppression is scoped to the smallest applicable item, not a whole module or crate.

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions