4 ms·
You can just specify the type along with the variable itself instead of relying on type inference in this case, which makes it look a lot better I think. There
by chlorion 4y ago
You can just specify the type along with the variable itself instead of relying on type inference in this case, which makes it look a lot better I think.
There is also the collect_vec method from Itertools that avoids this. I normally am not a big fan of pulling crates for little things like this, but the Itertools crate is used in rustc itself, so you already are trusting it if using rust.
I do agree that rust syntax can be a bit verbose sometimes but I actually prefer the syntax to most other languages! I would have preferred if it would have been less inspired by the C family of languages syntax wise, but that would have likely hindered adoption.