Skip to content

docs(clippy_utils): document StrIndex and its constructor#17026

Open
leno23 wants to merge 1 commit into
rust-lang:masterfrom
leno23:docs/str-index-new-doc-15569
Open

docs(clippy_utils): document StrIndex and its constructor#17026
leno23 wants to merge 1 commit into
rust-lang:masterfrom
leno23:docs/str-index-new-doc-15569

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 17, 2026

Summary

  • Document StrIndex and StrIndex::new in clippy_utils::str_utils.

Part of #15569

Made with Cursor

Describe when to use character vs byte indices and document `StrIndex::new`.

Part of rust-lang#15569

Co-authored-by: Cursor <cursoragent@cursor.com>
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label May 17, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 17, 2026

r? @samueltardieu

rustbot has assigned @samueltardieu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: 7 candidates
  • 7 candidates expanded to 7 candidates
  • Random selection from Jarcho, llogiq, samueltardieu

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 17, 2026

⚠️ Warning ⚠️

  • There are issue links (such as #123) in the commit messages of the following commits.
    Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.

Copy link
Copy Markdown
Member

@samueltardieu samueltardieu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix issue links and remove advertising in PR description.

View changes since this review

Comment on lines +2 to +5
///
/// Rust string slicing uses byte offsets, while many string algorithms reason
/// about character positions. Keeping both indices avoids accidental panics or
/// misaligned splits when working with non-ASCII text.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is useless, Clippy developers know that.

}

impl StrIndex {
/// Creates an index pairing a UTF-8 byte offset with a character offset.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one us useless as well.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels May 17, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 17, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants