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

ash: Remove unnecessary trivial_casts and trivial_numeric_casts #564

Merged
merged 1 commit into from
Feb 19, 2022

Conversation

MarijnS95
Copy link
Collaborator

@MarijnS95 MarijnS95 commented Jan 25, 2022

While making the code only marginally harder to read such casts can also introduce subtle bugs when used incorrectly, and are best omitted whenever unnecessary: Rust already coerces borrows into raw pointers when the types on both ends are clear, and even then there remain many casts that are identical to the source type.

In addition these errors show up when using a local crate reference to ash in a workspace that uses "the .cargo/config.toml setup" from EmbarkStudios/rust-ecosystem#68 to configure linter warnings project-wide instead of for all crates in that workspace individually. In our case aforementioned linter warnings are enabled on top of Embark's configuration, leading to a lot of these warnings in our build process.

ash/src/lib.rs Outdated Show resolved Hide resolved
generator/src/lib.rs Show resolved Hide resolved
@MarijnS95 MarijnS95 force-pushed the trivial-numeric-casts branch 3 times, most recently from 6619cae to a836f67 Compare January 26, 2022 10:32
@MarijnS95 MarijnS95 requested a review from Ralith January 27, 2022 11:20
@MarijnS95 MarijnS95 marked this pull request as ready for review January 27, 2022 11:20
While making the code only marginally harder to read such casts can also
introduce subtle bugs when used incorrectly, and are best omitted
whenever unnecessary: Rust already coerces borrows into raw pointers
when the types on both ends are clear, and even then there remain many
casts that are identical to the source type.

In addition these errors show up when using a local crate reference to
`ash` in a workspace that uses "the `.cargo/config.toml` setup" from
[EmbarkStudios/rust-ecosystem#68] to configure linter warnings
project-wide instead of for all crates in that workspace individually.
In our case aforementioned linter warnings are enabled on top of
Embark's configuration, leading to a lot of these warnings in our build
process.

[EmbarkStudios/rust-ecosystem#68]: EmbarkStudios/rust-ecosystem#68
@MarijnS95
Copy link
Collaborator Author

@Ralith is this something we can get in before any of the followup releases?

@Ralith Ralith merged commit e18e024 into master Feb 19, 2022
@Ralith Ralith deleted the trivial-numeric-casts branch February 19, 2022 00:01
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.

2 participants