Skip to content

chore(lint): enable clippy::string_slice - #10

Merged
tupe12334 merged 1 commit into
mainfrom
clippy/enable-string_slice
Jun 19, 2026
Merged

tupe12334 merged 1 commit into
mainfrom
clippy/enable-string_slice

Conversation

@tupe12334

Copy link
Copy Markdown
Member

Closes #9

What

Enable the clippy::string_slice restriction lint (set to deny) in lib/Cargo.toml.

Why

clippy::string_slice flags str/String slicing like &s[i..j], which panics at runtime when a byte index lands inside a UTF-8 multi-byte character. The crate's existing indexing_slicing = "deny" covers arrays/slices/Vec but not str; this lint closes that remaining panic gap, consistent with the crate's no-panic posture (unwrap_used, expect_used, panic, unreachable, indexing_slicing all denied). The fix-forward pattern is the fallible s.get(i..j).

Change

string_slice = "deny"

Single lint, no source changes — the crate has zero violations today.

Verification

  • cargo clippy --all-targets → clean (exit 0)
  • cargo build → ok
  • cargo test -- --test-threads=1 → 4 passed

(The install_pinned_version e2e test races on a shared temp dir under parallel execution — unrelated to this config-only change; it passes single-threaded and in isolation.)


This pull request was opened by the "Clippy lint improvements → issue + PR (Rust repos) → Slack" routine of moadim. cc @tupe12334

Forbid string slicing (`&s[i..j]`), which panics when an index falls inside
a UTF-8 multi-byte character boundary. The existing `indexing_slicing` deny
covers arrays/slices/`Vec` but not `str`; `string_slice` closes that remaining
panic gap, consistent with this crate's no-panic lint posture.

No code changes were required — the crate has zero violations today.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@tupe12334
tupe12334 merged commit b12691f into main Jun 19, 2026
2 checks passed
@tupe12334
tupe12334 deleted the clippy/enable-string_slice branch June 19, 2026 13:10
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::string_slice lint

1 participant