Skip to content

chore: Audit and Remove Unused #[allow(dead_code)] Suppressions Across All Modules #629

Description

@Samuel1505

Description

New module stubs added for issues 96–185 were created with skeleton function signatures that the compiler flags as dead code. Once a module is implemented, all #[allow(dead_code)] and #[allow(unused)] suppressions should be removed. This chore performs a full audit, removes all suppression attributes, fixes any resulting warnings, and ensures cargo clippy -- -D warnings passes with zero warnings.

Files to Modify

  • Every .rs file in contracts/stellar-grants/src/ that contains #[allow(dead_code)] or #[allow(unused)]

Technical Requirements

Audit steps:

  1. Run: grep -rn "allow(dead_code)\|allow(unused)" src/
  2. For each occurrence, determine if the suppression is still needed:
    • If the code is now called → remove the #[allow].
    • If the code is genuinely unused but intentionally public API → keep but document why.
    • If the code is truly dead → delete the dead code.
  3. Run cargo clippy -- -D warnings after each batch of removals.

Common patterns to clean up:

// REMOVE if function is now called:
#[allow(dead_code)]
pub fn some_function() { ... }

// REMOVE if struct field is now used:
#[allow(dead_code)]
pub unused_field: u32,

// KEEP with comment if intentionally part of public ABI:
/// Reserved for future use in protocol v3 upgrade path.
#[allow(dead_code)]
pub fn future_hook() { ... }

Clippy lints to resolve:

  • clippy::needless_return — remove explicit return at end of function.
  • clippy::redundant_clone — remove unnecessary .clone().
  • clippy::match_like_matches_macro — simplify match-bool patterns.
  • clippy::unnecessary_unwrap — replace .unwrap() with ? where applicable.

Acceptance Criteria

  • cargo clippy -- -D warnings passes with zero warnings.
  • All #[allow(dead_code)] suppressions either removed or justified with a comment.
  • No public API surface removed (only genuinely dead private code).
  • All existing tests still pass.
  • PR diff shows net negative line count (more deletions than additions).

Estimated Effort

Beginner: 2-4 hours

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions