On Tue, Oct 28, 2025 at 3:44 PM Alexandre Courbot <[email protected]> wrote: > > intent with the latter was to say "I would normally have done an `as`, > but instead here is a method that attests that this operations is indeed > lossless and safe".
Yeah, so you want that, when we see `_as`, we are reminded that this is the equivalent but lossless of that, which sounds OK. Though I wouldn't say "I would normally have done ...", but rather turn it around and say "Since we want to avoid `as`, here is a method ...". Now, I suggested a change because typically I would expect names to mention what they are about/do, rather than how they are implemented. The implementation in this case also doesn't say much, i.e. a type cast expression can be used for many things, and worse, the operator may or may not be lossless, so it isn't a big hint. But, yeah, I understand that you want to evoke the relationship above. I also suggested it because when I wrote the message I was thinking about the `cfg`s message, i.e. most of these depend on the architecture, and thus having an `arch` or similar does evoke a "careful, my code may not be portable anymore". On the other hand, it is true that the `u32_as_usize` case will most likely always be available, in practice, unlike the others. So an `arch` for that one isn't great (but I guess it could still matter for someone wanting to reuse the code in a different project/domain). In any case, personally I don't mind it too much either way -- whatever looks best for most. Cheers, Miguel
