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

Add new lint: used_underscore_items #13294

Merged
merged 2 commits into from
Aug 27, 2024

Conversation

WeiTheShinobi
Copy link
Contributor

@WeiTheShinobi WeiTheShinobi commented Aug 21, 2024

Closes #13260


changelog: new [used_underscore_items] lint against using items with a single leading underscore

@rustbot
Copy link
Collaborator

rustbot commented Aug 21, 2024

r? @llogiq

rustbot has assigned @llogiq.
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 Aug 21, 2024
clippy_lints/src/misc.rs Outdated Show resolved Hide resolved
@y21
Copy link
Member

y21 commented Aug 22, 2024

FWIW, pretty much almost all of the x86 platform intrinsics are prefixed with an underscore: https://doc.rust-lang.org/stable/core/arch/x86_64/index.html

Seems unfortunate if we start linting on any use of them... 🤔

@llogiq
Copy link
Contributor

llogiq commented Aug 24, 2024

I think a good balance here would be to check only the use of intra-crate items (that is items from the current crate), as the user cannot control how others name their items.

Copy link
Contributor

@llogiq llogiq left a comment

Choose a reason for hiding this comment

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

I'm not sure why we compare names instead of crate indices. Otherwise this looks good.

clippy_lints/src/misc.rs Outdated Show resolved Hide resolved
@llogiq
Copy link
Contributor

llogiq commented Aug 27, 2024

Thank you!

@bors r+

@bors
Copy link
Collaborator

bors commented Aug 27, 2024

📌 Commit d40e04a has been approved by llogiq

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Aug 27, 2024

⌛ Testing commit d40e04a with merge 603d5a1...

@bors
Copy link
Collaborator

bors commented Aug 27, 2024

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

@bors bors merged commit 603d5a1 into rust-lang:master Aug 27, 2024
11 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.

Lint use of functions with underscore-prefixed names
5 participants