-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add as_conversions lint
#4821
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 as_conversions lint
#4821
Conversation
0747b0d to
8c2047f
Compare
|
Do I move this to nursery if we don't plan to use it in clippy? Also, how to test eating dogfood? |
clippy_lints/src/as_conversions.rs
Outdated
| /// **Example:** | ||
| /// ```rust | ||
| /// let a: u32 = 0; | ||
| /// let p = &a as *const u32 as *mut u32; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add an example that shows the better alternative here? Similar to https://rust-lang.github.io/rust-clippy/master/index.html#default_trait_access
Pedantic is totally fine. Whenever we have a lint that doesn't really work well for Clippy we usually use |
|
I'd vote for
|
|
☔ The latest upstream changes (presumably #4839) made this pull request unmergeable. Please resolve the merge conflicts. |
f93c0d2 to
9a2c011
Compare
flip1995
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! r=me with rustup
actuall add files add better example and change pedantic to restriction
9a2c011 to
9ec8888
Compare
|
@bors r=flip1995 |
|
📌 Commit 9ec8888 has been approved by |
Add `as_conversions` lint changelog: closes #4771, adding a new pedantic allow-by-default lint that lints against any usage of `as`.
|
☀️ Test successful - checks-travis, status-appveyor |
|
|
||
| fn main() { | ||
| let i = 0u32 as u64; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing macro test cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, I'll open a follow-up pr
changelog: closes #4771, adding a new pedantic allow-by-default lint that lints against any usage of
as.