Skip to content

lints: adopt the canonical lints block - #4

Merged
h4x0r merged 1 commit into
mainfrom
lints/canonical-lints
Aug 5, 2026
Merged

h4x0r merged 1 commit into
mainfrom
lints/canonical-lints

Conversation

@h4x0r

@h4x0r h4x0r commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

lints: adopt the canonical lints block

jsonguard had no [lints] block at all - no unsafe_code key, no
unwrap_used/expect_used, no pedantic. It now carries the canonical recipe
(CLAUDE.core.md "Rust Lint Posture") with the panic-lint superset:

unsafe_code = "forbid" (the crate contains no unsafe)
correctness / suspicious = "deny"
unwrap_used / expect_used = "deny"
all + pedantic = "warn", with the canonical cast_* allows

Nothing in production code used unwrap or expect - every such site was in
a test module, which now carries the sanctioned
#![cfg_attr(test, allow(...))] (and the integration test its own
top-level allow).

What the new lints surfaced, all fixed at the source:

clippy::match_same_arms 2 arms merged (types.rs collapses three
=> true arms; text.rs folds the C0,
DEL/C1 and bidi escapes into one arm)
clippy::format_push_string 3 replaced by a write_unicode_escape
helper over fmt::Write, which is also
what let the three arms merge
clippy::unnested_or_patterns 1 fixed
plus 3 machine-applicable fixes from clippy --fix

One allow is added, with its reason recorded in the manifest:

needless_pass_by_value 6 sites. The public API is deliberately
pub fn f<I: GuardInput>(input: I) - generic-by-value is the seam that
lets a caller pass &str, &[u8] or String unchanged. Taking &I would
break every caller and defeat the trait, so this is a false positive
against the design, not a defect to fix.

Gate: cargo build --all-targets --all-features, cargo test --all-features
(171 tests) and --no-default-features, cargo clippy --workspace
--all-targets --all-features -- -D warnings, cargo fmt --check - all clean.

Co-Authored-By: Claude Opus 5 (1M context) noreply@anthropic.com

🤖 Generated with Claude Code

jsonguard had no [lints] block at all - no unsafe_code key, no
unwrap_used/expect_used, no pedantic. It now carries the canonical recipe
(CLAUDE.core.md "Rust Lint Posture") with the panic-lint superset:

  unsafe_code = "forbid"   (the crate contains no unsafe)
  correctness / suspicious = "deny"
  unwrap_used / expect_used = "deny"
  all + pedantic = "warn", with the canonical cast_* allows

Nothing in production code used unwrap or expect - every such site was in
a test module, which now carries the sanctioned
`#![cfg_attr(test, allow(...))]` (and the integration test its own
top-level allow).

What the new lints surfaced, all fixed at the source:

  clippy::match_same_arms         2  arms merged (types.rs collapses three
                                     `=> true` arms; text.rs folds the C0,
                                     DEL/C1 and bidi escapes into one arm)
  clippy::format_push_string      3  replaced by a write_unicode_escape
                                     helper over fmt::Write, which is also
                                     what let the three arms merge
  clippy::unnested_or_patterns    1  fixed
  plus 3 machine-applicable fixes from clippy --fix

One allow is added, with its reason recorded in the manifest:

  needless_pass_by_value  6 sites. The public API is deliberately
  `pub fn f<I: GuardInput>(input: I)` - generic-by-value is the seam that
  lets a caller pass &str, &[u8] or String unchanged. Taking `&I` would
  break every caller and defeat the trait, so this is a false positive
  against the design, not a defect to fix.

Gate: cargo build --all-targets --all-features, cargo test --all-features
(171 tests) and --no-default-features, cargo clippy --workspace
--all-targets --all-features -- -D warnings, cargo fmt --check - all clean.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@h4x0r
h4x0r marked this pull request as ready for review August 5, 2026 20:27
@h4x0r
h4x0r merged commit 99f6392 into main Aug 5, 2026
8 checks passed
@h4x0r
h4x0r deleted the lints/canonical-lints branch August 9, 2026 15:28
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.

1 participant