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

Improve cast_ptr_alignment lint #4257

Merged
merged 1 commit into from
Jul 9, 2019
Merged

Conversation

skade
Copy link
Contributor

@skade skade commented Jul 6, 2019

  • print alignment in bytes in the lint message
  • ignore ZST left-hand types

Fixes #3797 and #4256
changelog:

  • cast_ptr_alignment: Print alignment in bytes in the lint message
  • cast_ptr_alignment: Ignore casting from ZST left-hand types

@Manishearth
Copy link
Member

Please add a changelog entry to the PR body

clippy_lints/src/types.rs Outdated Show resolved Hide resolved
@skade
Copy link
Contributor Author

skade commented Jul 7, 2019

@Manishearth @flip1995 done and done, thanks :)

clippy_lints/src/types.rs Outdated Show resolved Hide resolved
@skade
Copy link
Contributor Author

skade commented Jul 7, 2019

Train WiFi, where seconds become hours. I rewrote the patch a little. It now computes the layout and then does member accesses everywhere. That makes the accesses more verbose, but the whole things stays consistent.

clippy_lints/src/types.rs Outdated Show resolved Hide resolved
* print alignment in bytes in the lint message
* ignore ZST left-hand types
@skade
Copy link
Contributor Author

skade commented Jul 9, 2019

Added @flip1995's suggestion, currently running through CI.

@flip1995
Copy link
Member

flip1995 commented Jul 9, 2019

@bors r+

@bors
Copy link
Collaborator

bors commented Jul 9, 2019

📌 Commit aa72cac has been approved by flip1995

@bors
Copy link
Collaborator

bors commented Jul 9, 2019

⌛ Testing commit aa72cac with merge 032ae96...

bors added a commit that referenced this pull request Jul 9, 2019
Improve cast_ptr_alignment lint

<!--
Thank you for making Clippy better!

We're collecting our changelog from pull request descriptions.
If your PR only updates to the latest nightly, you can leave the
`changelog` entry as `none`. Otherwise, please write a short comment
explaining your change.

If your PR fixes an issue, you can add "fixes #issue_number" into this
PR description. This way the issue will be automatically closed when
your PR is merged.

If you added a new lint, here's a checklist for things that will be
checked during review or continuous integration.

- [x] Followed [lint naming conventions][lint_naming]
- [x] Added passing UI tests (including committed `.stderr` file)
- [x] `cargo test` passes locally
- [x] Executed `util/dev update_lints`
- [x] Added lint documentation
- [x] Run `cargo fmt`

Note that you can skip the above if you are just opening a WIP PR in
order to get feedback.

Delete this line and everything above before opening your PR -->

* print alignment in bytes in the lint message
* ignore ZST left-hand types

Fixes #3797 and #4256
changelog:
* `cast_ptr_alignment`: Print alignment in bytes in the lint message
* `cast_ptr_alignment`: Ignore casting from ZST left-hand types
@bors
Copy link
Collaborator

bors commented Jul 9, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cast_ptr_alignment should include a note with the alignment of types involved
4 participants