Skip to content

chore(lint): enable clippy::allow_attributes_without_reason - #12

Merged
tupe12334 merged 2 commits into
mainfrom
lint/enable-allow_attributes_without_reason
Jun 22, 2026
Merged

tupe12334 merged 2 commits into
mainfrom
lint/enable-allow_attributes_without_reason

Conversation

@tupe12334

Copy link
Copy Markdown
Member

Closes #11

What

Enables the Clippy restriction lint allow_attributes_without_reason at deny in lib/Cargo.toml, then adds a reason = "..." to every existing #[allow(...)] so the build stays green.

Why

A suppression is exactly where a reviewer wants to know why the lint was turned off. This rule makes every #[allow] self-documenting and prevents stale/unexplained suppressions from accumulating — complementing the crate's existing panic-safety deny set.

Changes

  • lib/Cargo.toml: add allow_attributes_without_reason = "deny" (with an explanatory comment).
  • Add reason = "..." to all 8 suppressions:
    • 7 test-module allows opting out of unwrap_used/expect_used/panic (reason: tests use these for brevity; only production code must stay panic-free).
    • the retained ReleaseInfo::tag dead_code allow (reason: retained for consumers needing the resolved tag).

No production logic changed; only attribute metadata + one config line.

Verification

  • cargo clippy --all-targets — passes (was failing on the 8 sites until reasons were added).
  • cargo build — passes.
  • cspell — no new spelling issues introduced.

This pull request was opened by the "Add lint rule → issue + PR (owned repos + my orgs) → Slack" routine of moadim. cc @tupe12334

Deny `clippy::allow_attributes_without_reason` so every `#[allow(...)]`
must carry a `reason = "..."`. Add reasons to all existing suppressions
(test-module unwrap/expect/panic allows and the retained `tag` field).

Keeps lint suppressions auditable and prevents stale/unexplained allows.
…nion-resolve lint-config conflict

Resolved by the "Resolve conflicts on code-quality PRs (non-guiddeco)" routine of moadim.
@tupe12334
tupe12334 merged commit f31a670 into main Jun 22, 2026
2 checks passed
@tupe12334
tupe12334 deleted the lint/enable-allow_attributes_without_reason branch June 22, 2026 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable clippy::allow_attributes_without_reason lint rule

1 participant