Skip to content

New lint: always_true_conditions #14434

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Dominic-Moser
Copy link

This lint closes #1593

This is my first lint, please let me know if I messed something up anywhere!

changelog: [always_true_conditions]: add new lint

@rustbot
Copy link
Collaborator

rustbot commented Mar 18, 2025

r? @Alexendoo

rustbot has assigned @Alexendoo.
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

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Mar 18, 2025
@samueltardieu
Copy link
Contributor

The lintcheck results shows 64 hits, which seem to be all false positives.

@samueltardieu
Copy link
Contributor

@Dominic-Moser Do you plan to continue working on this lint?
@rustbot author

@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 Apr 6, 2025
@rustbot
Copy link
Collaborator

rustbot commented Apr 6, 2025

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

@Dominic-Moser
Copy link
Author

@rustbot ready, sorry school's been hitting hard

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties and removed S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels Apr 8, 2025
@Dominic-Moser
Copy link
Author

never mind, I have to to checks to make sure the same variable is being used throughout the whole expression

@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

@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 Apr 18, 2025
@rustbot

This comment has been minimized.

@Dominic-Moser
Copy link
Author

@samueltardieu I am so confused right now, I keep trying to rebase and it keeps saying I need to rebase. I am sure this is my fault but i have no clue how to fix this...
On the bright side I do actually think that the code works properly now 🫠

@rustbot

This comment has been minimized.

@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 Apr 18, 2025
@rustbot

This comment has been minimized.

@Alexendoo
Copy link
Member

Your first commit contains a lot of unrelated changes 9ce8566

What I would do is first reset your branch to the current state of master

git fetch upstream
git reset --hard upstream/master

Then grab the main parts of the PR - the lint and the test file

git checkout b55d82f89c1b29f25044aeaafbbdb7a241c82c3b -- clippy_lints/src/always_true_conditions.rs tests/ui/always_true_conditions.rs

Now you can run cargo dev update_lints, add the lint registration to clippy_lints/src/lib.rs again, and make sure tests pass. Then you can create the commit once more

@Alexendoo Alexendoo 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 Apr 20, 2025
@Dominic-Moser
Copy link
Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties and removed S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels May 3, 2025
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.

Always true expressions in if expressions
4 participants