[–] vkjv 8y ago ↗ Types on collections got much less onerous once I realized that they could be partially elided. let another: Vec<u64> = some_vec.iter().map(|x|x + 5).collect(); Typically the `u64` part can be inferred based on the `map` function. Drop in `_` to elide the inner type. let another: Vec<_> = some_vec.iter().map(|x|x + 5).collect(); And if you are doing something later that implies `Vec<u64`, you can omit the type completely.
1 comment
[ 2.6 ms ] story [ 14.3 ms ] thread