Repository navigation
chore(lint): enable clippy::string_slice - #10
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #9
What
Enable the
clippy::string_slicerestriction lint (set todeny) inlib/Cargo.toml.Why
clippy::string_sliceflagsstr/Stringslicing like&s[i..j], which panics at runtime when a byte index lands inside a UTF-8 multi-byte character. The crate's existingindexing_slicing = "deny"covers arrays/slices/Vecbut notstr; this lint closes that remaining panic gap, consistent with the crate's no-panic posture (unwrap_used,expect_used,panic,unreachable,indexing_slicingall denied). The fix-forward pattern is the fallibles.get(i..j).Change
Single lint, no source changes — the crate has zero violations today.
Verification
cargo clippy --all-targets→ clean (exit 0)cargo build→ okcargo test -- --test-threads=1→ 4 passed(The
install_pinned_versione2e 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