1

Disable `cast_lossless` when casting to u128 from any (u)int type by Jacherr · P...

 1 month ago
source link: https://github.com/rust-lang/rust-clippy/pull/12496
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Conversation

Contributor

Fixes #12492

Disables cast_lossless when casting to u128 from any int or uint type. The lint states that when casting to any int type, there can potentially be lossy behaviour if the source type ever exceeds the size of the destination type in the future, which is impossible with a destination of u128.

It's possible this is a bit of a niche edge case which is better addressed by just disabling the lint in code, but I personally couldn't think of any good reason to still lint in this specific case - maybe except if the source is a bool, for readability reasons :).

changelog: FP: cast_lossless: disable lint when casting to u128 from any (u)int type


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK