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

used_underscore_bindings: respect lint levels on the binding definition #11523

Merged

Conversation

Alexendoo
Copy link
Member

Fixes #11520
Fixes #947

Also ignores usages of PhantomData

changelog: none

@rustbot
Copy link
Collaborator

rustbot commented Sep 17, 2023

r? @Jarcho

(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 Sep 17, 2023
Level::Allow => return,
Level::Expect(id) => {
cx.fulfill_expectation(id);
return;
Copy link
Member

Choose a reason for hiding this comment

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

This check might miss a second expectation, if there is also one on the statement level. I think in 99.9% of the cases it should be fine, but it might be safer to also check the level at expr and potentially fulfill a second expectation. :)

Otherwise very nice check :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Aha makes sense, does the ForceWarn expectation ever need to be fulfilled?

Copy link
Member

Choose a reason for hiding this comment

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

The force warn expectation should be handled exactly the same as a normal one. That one becomes relevant if there is an #[expect] and the user specifies a --force-warn in via the console arguments

Copy link
Member Author

Choose a reason for hiding this comment

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

Am I understanding correctly that --force-warn foo turns all the #[expect(foo)]s into Level::ForceWarn(Some(_))?

Personally I would still expect the lint to emit if --force-warn was passed, but it could probably still fulfill the expectation to not create a new warning/error

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, sorry, I typed my answer on the go 😅. With --force-warn the lint should be emitted as normal, that will emit the lint and fulfill the lint expectation IIRC

@Alexendoo
Copy link
Member Author

r? @xFrednet

@rustbot rustbot assigned xFrednet and unassigned Jarcho Sep 17, 2023
@Alexendoo Alexendoo force-pushed the used-underscore-bindings-lint-levels branch from c0b5f07 to 32d3387 Compare September 17, 2023 20:40
@xFrednet
Copy link
Member

LGTM, thank you for the update. I really like the fulfill_or_allowed function 👍

Looking forward to have this fix in the next rustup of Marker :D

@bors r+

@bors
Copy link
Contributor

bors commented Sep 18, 2023

📌 Commit 32d3387 has been approved by xFrednet

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Sep 18, 2023

⌛ Testing commit 32d3387 with merge c92de58...

@bors
Copy link
Contributor

bors commented Sep 18, 2023

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

@bors bors merged commit c92de58 into rust-lang:master Sep 18, 2023
@Alexendoo Alexendoo deleted the used-underscore-bindings-lint-levels branch September 18, 2023 09:53
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.

Check if clippy::used_underscore_binding is allowed on the underscore field Fix used_underscore_binding
5 participants