Casting

Casting numbers is sometimes a dangerous operation. We could lose precision, lose sign, truncate numbers, and so on. Clippy gives us some very useful lints that can avoid these situations. Of course, often you do not care about these behaviors since you might know they won't happen or they could be intended behavior.

Nevertheless, I have found these lints useful even if you only activate them on one occasion to check the places where these casts take place and set them to allow by default when usual testing.

The lints are the following:

  • cast_possible_truncation
  • cast_possible_wrap
  • cast_precision_loss
  • cast_sign_loss
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.218.157