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

Uplift clippy::double_neg lint as double_negations #126604

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

Conversation

kadiwa4
Copy link
Contributor

@kadiwa4 kadiwa4 commented Jun 17, 2024

Warns about cases like this:

fn main() {
    let x = 1;
    let _b = --x; //~ WARN use of a double negation
}

The intent is to keep people from thinking that --x is a prefix decrement operator. ++x, x++ and x-- are invalid expressions and already have a helpful diagnostic.

I didn't add a machine-applicable suggestion to the lint because it's not entirely clear what the programmer was trying to achieve with the --x operation. The code that triggers the lint should always be reviewed manually.

Closes #82987

@rustbot
Copy link
Collaborator

rustbot commented Jun 17, 2024

r? @nnethercote

rustbot has assigned @nnethercote.
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 S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 17, 2024
@rustbot
Copy link
Collaborator

rustbot commented Jun 17, 2024

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@rust-log-analyzer

This comment has been minimized.

@kadiwa4
Copy link
Contributor Author

kadiwa4 commented Jun 18, 2024

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 18, 2024
@compiler-errors compiler-errors added T-lang Relevant to the language team, which will review and decide on the PR/issue. I-lang-nominated Nominated for discussion during a lang team meeting. and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 18, 2024
@nnethercote
Copy link
Contributor

This needs T-lang approval. The appropriate labels have been applied to summon them.

@bors
Copy link
Contributor

bors commented Jun 30, 2024

☔ The latest upstream changes (presumably #127174) made this pull request unmergeable. Please resolve the merge conflicts.

@kadiwa4 kadiwa4 changed the title Uplift clippy::double_neg lint as double_negation Uplift clippy::double_neg lint as double_negations Sep 1, 2024
@rust-log-analyzer

This comment has been minimized.

@kadiwa4
Copy link
Contributor Author

kadiwa4 commented Sep 1, 2024

@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 (such as code changes or more information) from the author. labels Sep 1, 2024
@nnethercote
Copy link
Contributor

Still waiting on T-lang, AFAICT.

@kadiwa4
Copy link
Contributor Author

kadiwa4 commented Sep 30, 2024

@rustbot label: -S-waiting-on-review +S-waiting-on-team

@rustbot rustbot added S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 30, 2024
@bors
Copy link
Contributor

bors commented Oct 29, 2024

☔ The latest upstream changes (presumably #128985) made this pull request unmergeable. Please resolve the merge conflicts.

@rust-log-analyzer

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-lang-nominated Nominated for discussion during a lang team meeting. S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Uplift clippy::double_neg into rustc
7 participants