7 ms·
I'd even made your same comment about Strings over on reddit last week - it's not like the ways it's doing it are wrong at all. It's more that newbies can suffe
by jkoudys 6y ago
I'd even made your same comment about Strings over on reddit last week - it's not like the ways it's doing it are wrong at all. It's more that newbies can suffer decision paralysis when you are obsessed with learning the "right way" to do something, but there's no clear answer. Do I `.map(String::from)`, do I `.map(From::from)` and let things infer? Do I `.map(|s| s.into())`? `.map(|s| s.to_owned())`? `.map(|s| s.to_string())`? You can drive yourself crazy over the most meaningless, pointless questions in your code.
The surprising thing is, I find rust an incredibly effective language at sparing me from worrying about trivialities. Once you learn the slight differences in what all those things mean, you can be pretty direct. Overall I find rust one of the harder languages to write, but one of the easiest to read, and reading code is generally where you'll spend more time.