Skip to content

cs(clippy_lints): add detailed comments for SINGLE_RANGE_IN_VEC_INIT …#16598

Open
zayutaha wants to merge 1 commit intorust-lang:masterfrom
zayutaha:feat/single-range-in-vec-2
Open

cs(clippy_lints): add detailed comments for SINGLE_RANGE_IN_VEC_INIT …#16598
zayutaha wants to merge 1 commit intorust-lang:masterfrom
zayutaha:feat/single-range-in-vec-2

Conversation

@zayutaha
Copy link
Copy Markdown
Contributor

@zayutaha zayutaha commented Feb 20, 2026

changelog: [single_range_in_vec]: Added lint documentation with doc comments explaining the lint, its rationale, and examples covering inclusive ranges and open-ended ranges

Adds documentation to the single_range_in_vec lint.

Added doc comments explaining what the lint does, why it is bad, and examples.
Covered inclusive ranges, open-ended ranges, and ignored infinite ranges.
Clarified start/end snippet extraction, applicability, and suggested fixes.
Updated examples for arrays and Vec initializations.

Fixes #16508

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Feb 20, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Feb 20, 2026

r? @Jarcho

rustbot has assigned @Jarcho.
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, dswij, llogiq, samueltardieu

@zayutaha zayutaha force-pushed the feat/single-range-in-vec-2 branch from 7a8e232 to e5242d9 Compare February 21, 2026 04:28
@zayutaha
Copy link
Copy Markdown
Contributor Author

😅 Forgot to run clippy on rust-clippy.

Comment thread clippy_lints/src/single_range_in_vec_init.rs
Comment thread tests/ui/single_range_in_vec_init.1.fixed Outdated
Copy link
Copy Markdown
Contributor

@llogiq llogiq left a comment

Choose a reason for hiding this comment

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

I just have some small nits, otherwise this looks good.

View changes since this review

@samueltardieu
Copy link
Copy Markdown
Member

And your full PR description would look something like:

Also, you forgot to remove the instructions the LLM gave you in the PR description.

@zayutaha
Copy link
Copy Markdown
Contributor Author

Sorry, I should've read it more closely.

…lint

- Added doc comments explaining what the lint does, why it is bad, and examples.
- Covered inclusive ranges, open-ended ranges, and ignored infinite ranges.
- Clarified start/end snippet extraction, applicability, and suggested fixes.
- Updated examples for arrays and Vec initializations.

Fixes rust-lang#16508
@zayutaha zayutaha force-pushed the feat/single-range-in-vec-2 branch from e5242d9 to e264a69 Compare February 22, 2026 16:45
@zayutaha zayutaha requested a review from llogiq February 22, 2026 23:44
@zayutaha
Copy link
Copy Markdown
Contributor Author

Hey @llogiq !

I have updated the MR and am looking forward for your review. Thanks in advance!

@zayutaha
Copy link
Copy Markdown
Contributor Author

zayutaha commented Mar 8, 2026

Hi @llogiq, It has been a couple of weeks 😄, Can you please take a look or if you are busy maybe reassign it to someone else ?

@Jarcho
Copy link
Copy Markdown
Contributor

Jarcho commented Mar 27, 2026

Why are we trying to lint RangeTo here? It can make sense with unsigned integers, but any other type doesn't have much of alternative interpretation unless the starting bound was also forgotten.

Ping @Centri3. What was the reason for suggesting [x; y] instead of [x..y]? Is this a mistake people are actually making?

@zayutaha
Copy link
Copy Markdown
Contributor Author

@Jarcho Would it be alright if I add you as a reviewer?

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

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties

Projects

None yet

Development

Successfully merging this pull request may close these issues.

single_range_in_vec_init should detect all kind of ranges

5 participants