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 as_conversions lint #4821

Merged
merged 1 commit into from
Nov 28, 2019
Merged

Add as_conversions lint #4821

merged 1 commit into from
Nov 28, 2019

Conversation

basil-cow
Copy link
Contributor

changelog: closes #4771, adding a new pedantic allow-by-default lint that lints against any usage of as.

@basil-cow
Copy link
Contributor Author

basil-cow commented Nov 15, 2019

Do I move this to nursery if we don't plan to use it in clippy? Also, how to test eating dogfood?

/// **Example:**
/// ```rust
/// let a: u32 = 0;
/// let p = &a as *const u32 as *mut u32;
Copy link
Member

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

@phansch
Copy link
Member

phansch commented Nov 18, 2019

Do I move this to nursery if we don't plan to use it in clippy? Also, how to test eating dogfood?

Pedantic is totally fine. Whenever we have a lint that doesn't really work well for Clippy we usually use #[allow(clippy::lintname)] very liberally.

@flip1995
Copy link
Member

I'd vote for restriction:

I'd say it should be in restriction, since it restricts the language. (And is too pedantic even for pedantic)

@basil-cow basil-cow changed the title implemented as_conversions lint Add as_conversions lint Nov 19, 2019
@bors
Copy link
Contributor

bors commented Nov 23, 2019

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

Copy link
Member

@flip1995 flip1995 left a 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

@flip1995 flip1995 added the S-waiting-on-bors Status: The marked PR was approved and is only waiting bors label Nov 25, 2019
actuall add files

add better example and change pedantic to restriction
@flip1995 flip1995 added the A-lint Area: New lints label Nov 25, 2019
@phansch
Copy link
Member

phansch commented Nov 28, 2019

@bors r=flip1995

@bors
Copy link
Contributor

bors commented Nov 28, 2019

📌 Commit 9ec8888 has been approved by flip1995

@bors
Copy link
Contributor

bors commented Nov 28, 2019

⌛ Testing commit 9ec8888 with merge d377486...

bors added a commit that referenced this pull request Nov 28, 2019
Add `as_conversions` lint

changelog: closes #4771, adding a new pedantic allow-by-default lint that lints against any usage of `as`.
@bors
Copy link
Contributor

bors commented Nov 28, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: flip1995
Pushing d377486 to master...

@bors bors merged commit 9ec8888 into rust-lang:master Nov 28, 2019

fn main() {
let i = 0u32 as u64;

Copy link
Contributor

Choose a reason for hiding this comment

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

Missing macro test cases.

Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints S-waiting-on-bors Status: The marked PR was approved and is only waiting bors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request: A single lint for any usage at all of as
5 participants