Skip to content

Conversation

not-elm
Copy link

@not-elm not-elm commented Feb 23, 2024

Fixed #12243

changelog: Fix[redundant_guards]

I have made a correction so that no warning does appear when y.is_empty() is used within a constant function as follows.

pub const fn const_fn(x: &str) {
    match x {
        // Shouldn't lint.
        y if y.is_empty() => {},
        _ => {},
    }
}

@rustbot
Copy link
Collaborator

rustbot commented Feb 23, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @y21 (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Feb 23, 2024
@rustbot rustbot added the has-merge-commits PR has merge commits, merge with caution. label Feb 24, 2024
@rustbot
Copy link
Collaborator

rustbot commented Feb 24, 2024

There are merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged.

You can start a rebase with the following commands:

$ # rebase
$ git rebase -i master
$ # delete any merge commits in the editor that appears
$ git push --force-with-lease

The following commits are merge commits:

@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 has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels Feb 24, 2024
@not-elm
Copy link
Author

not-elm commented Feb 24, 2024

Thank you for pointing me to the alternative.
Please review again as it has been corrected.

Copy link
Member

@y21 y21 left a comment

Choose a reason for hiding this comment

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

One small nit, then it LGTM

@rustbot rustbot added has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels Feb 25, 2024
@rustbot
Copy link
Collaborator

rustbot commented Feb 25, 2024

There are merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged.

You can start a rebase with the following commands:

$ # rebase
$ git rebase -i master
$ # delete any merge commits in the editor that appears
$ git push --force-with-lease

The following commits are merge commits:

A warning is now suppressed when "<str_va> if <str_var>.is_empty" is used in a constant function.

FIX: instead of clippy_util::in_const

FIX: Merged `redundant_guards_const_fn.rs` into `redundant_guards.rs`.
@rustbot rustbot removed has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels Feb 25, 2024
@y21
Copy link
Member

y21 commented Feb 25, 2024

Looks great, thanks!

@bors r+

@bors
Copy link
Contributor

bors commented Feb 25, 2024

📌 Commit 5a63cd8 has been approved by y21

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Feb 25, 2024

⌛ Testing commit 5a63cd8 with merge c469cb0...

@bors
Copy link
Contributor

bors commented Feb 25, 2024

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

@bors bors merged commit c469cb0 into rust-lang:master Feb 25, 2024
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 does not take const fn-ness into account
4 participants