Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[redundant_guards]: catch is_empty, starts_with and ends_with on slices and strs #11818

Merged
merged 5 commits into from Nov 29, 2023

Conversation

y21
Copy link
Member

@y21 y21 commented Nov 15, 2023

Fixes #11807

Few things worth mentioning:

  • Taking snippets is now done at callsite, instead of passing a span and doing it in emit_redundant_guards. This is because we now need custom suggestion strings in certain places, like "" for str::is_empty.
  • This now uses snippet instead of snippet_with_applicability. I don't think this really makes any difference for MaybeIncorrect, though?
  • This could also lint byte strings, as they're of type &[u8; N], but that can be ugly so I decided to leave it out for now

changelog: [redundant_guards]: catch str::is_empty, slice::is_empty, slice::starts_with and slice::ends_with

@rustbot
Copy link
Collaborator

rustbot commented Nov 15, 2023

r? @llogiq

(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 15, 2023
@llogiq
Copy link
Contributor

llogiq commented Nov 29, 2023

This looks good to me. Thank you!

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 29, 2023

📌 Commit 8f9c738 has been approved by llogiq

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Nov 29, 2023

⌛ Testing commit 8f9c738 with merge 8b0bf64...

@bors
Copy link
Collaborator

bors commented Nov 29, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: llogiq
Pushing 8b0bf64 to master...

@bors bors merged commit 8b0bf64 into rust-lang:master Nov 29, 2023
5 checks passed
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.

redundant_guards could lint against more checks in the standard library
4 participants