2 ms·
> I am trying to use safe `From::from` instead. However, this is a bit noisy: `usize::from(n)` vs `n as usize`. If there's enough information in the surroundin
by kelnos 2y ago
> I am trying to use safe `From::from` instead. However, this is a bit noisy: `usize::from(n)` vs `n as usize`.
If there's enough information in the surrounding code for type inference to do its thing, you can shorten it to `n.into()`.
- conaclos 2y agoAnother limitation I face is the impossibility of using `usize::from(n)` in `const` context.