#Are conversions using 'as' bad practice?
14 messages · Page 1 of 1 (latest)
Usually it leads to more bug-proof code because it helps detect conversion errors
as can silently result in lossy conversions
Which you might not want
There is also .into() if the type can always losslessly convert
It would be good practice, yeah
Sometimes as is fine, but if you want to prioritize correctness, you should try to use Into/TryInto as often as possible
alright, great
FYI: If you use an as, and it may result in a lossy conversation, I believe the compiler flags it up with a warning...
Given, as only works for primatives as well,
The lint isn't enabled by default, I think
it isn't