4 ms·
It's useful to have something that does the job of "as", but I dislike how the most dangerous tool for type conversions has the nicest syntax. Most of the time
by wongarsu 2y ago
It's useful to have something that does the job of "as", but I dislike how the most dangerous tool for type conversions has the nicest syntax.
Most of the time I want the behavior of ".try_into().unwrap()" (with the compiler optimizing the checks away if it's always safe) or would even prefer a version that only works if the conversion is safe and lossless (something I can reason about right now, but want to ensure even after refactorings). The latter is really hard to achieve, and ".try_into.unwrap()" is 20 characters where "as" is 2. Not a big deal to type with autocomplete, but a lot of visual clutter.