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

Refactor for DType::Primitive #276

Merged
merged 4 commits into from
Apr 30, 2024
Merged

Refactor for DType::Primitive #276

merged 4 commits into from
Apr 30, 2024

Conversation

gatesn
Copy link
Contributor

@gatesn gatesn commented Apr 30, 2024

Fixes #154

@gatesn gatesn requested a review from robert3005 April 30, 2024 10:35
@gatesn gatesn enabled auto-merge (squash) April 30, 2024 11:16
@gatesn gatesn disabled auto-merge April 30, 2024 11:36
@gatesn gatesn merged commit 9d955e6 into develop Apr 30, 2024
2 checks passed
@gatesn gatesn deleted the ngates/dtype-ptype branch April 30, 2024 11:36
pub fn is_unsigned_int(&self) -> bool {
PType::try_from(self)
.map(|ptype| ptype.is_unsigned_int())
.unwrap_or_default()
Copy link
Member

Choose a reason for hiding this comment

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

nit: personally I dislike unwrap_or_default, since it requires the reader to think/know the default of the type. For types that a trivial to instantiate, the explicit version is generally clearer -> i.e., unwrap_or(false)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think clippy yells at you for that. Maybe we can configure it to be opposite for primitives?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're not the only one: rust-lang/rust-clippy#11630

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.

Align Scalar and DType unions
2 participants