Skip to content

Conversation

y21
Copy link
Member

@y21 y21 commented Nov 18, 2023

Fixes #11835

The lint now allows indexing with indices 0 and 1 when an assert!(x.len() == 2); is found.
(Also fixed a typo in the doc example)

changelog: [missing_asserts_for_indexing]: accept len equality checks as a valid assertion

@rustbot
Copy link
Collaborator

rustbot commented Nov 18, 2023

r? @dswij

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Nov 18, 2023
@y21
Copy link
Member Author

y21 commented Nov 18, 2023

@SylvainDe Oh woops, I saw your comment that you wanted to give fixing this a try only after I was basically done with this. Sorry! 😅

@SylvainDe
Copy link

@y21 No worries at all, I'll glad that it is done!

@SylvainDe
Copy link

Anyone to review this ? It would make the missing_asserts_for_indexing check mush easier to use.

@dswij
Copy link
Member

dswij commented Dec 1, 2023

LGTM, thanks!

@bors r+

@bors
Copy link
Contributor

bors commented Dec 1, 2023

📌 Commit 4de845e has been approved by dswij

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Dec 1, 2023

⌛ Testing commit 4de845e with merge ee83760...

@bors
Copy link
Contributor

bors commented Dec 1, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: dswij
Pushing ee83760 to master...

@bors bors merged commit ee83760 into rust-lang:master Dec 1, 2023
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.

missing_asserts_for_indexing is emitted when length is checked with "==" (instead of ">")
5 participants