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 ptr_cast_constness #10779

Merged
merged 5 commits into from
May 23, 2023
Merged

Conversation

Centri3
Copy link
Member

@Centri3 Centri3 commented May 15, 2023

This adds a new lint which functions as the opposite side of the coin to ptr_as_ptr. Rather than linting only as casts that don't change constness, this lints only constness; suggesting to use pointer::cast_const or pointer::cast_mut instead.

changelog: new lint [ptr_cast_constness]

@rustbot
Copy link
Collaborator

rustbot commented May 15, 2023

r? @llogiq

(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 May 15, 2023
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.

One small nitpick, otherwise this looks good. r=me with the nit fixed. Thank you!

clippy_lints/src/casts/ptr_cast_constness.rs Outdated Show resolved Hide resolved
Co-authored-by: llogiq <bogusandre@gmail.com>
clippy_lints/src/casts/mod.rs Outdated Show resolved Hide resolved
tests/ui/ptr_cast_constness.rs Outdated Show resolved Hide resolved
tests/ui/ptr_cast_constness.rs Outdated Show resolved Hide resolved
@llogiq
Copy link
Contributor

llogiq commented May 23, 2023

Sorry for keeping you waiting. Thank you for writing the lint!

@bors r+

@bors
Copy link
Collaborator

bors commented May 23, 2023

📌 Commit 97467e4 has been approved by llogiq

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented May 23, 2023

⌛ Testing commit 97467e4 with merge a0fd17d...

@bors
Copy link
Collaborator

bors commented May 23, 2023

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

@bors bors merged commit a0fd17d into rust-lang:master May 23, 2023
7 checks passed
@Centri3 Centri3 deleted the ptr_cast_constness branch June 2, 2023 00:36
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.

None yet

4 participants