▲ | masklinn 5 days ago | |||||||
> Granted, these repercussions of these defaults also result in (in my opinion) verbose language constructs like iter, into_iter, iter_mut ↩ Note that assuming the into_iter comes from IntoIterator that’s what the for loop invokes to get an iterator from an iterable. So
Is completely unnecessary verbosity,
Will do the exact same thing. And the stdlib will generally implement the trait with the relevant semantics on shared and unique references so
Can generally be written
So you rarely need to invoke these methods outside of functional pipelines if you dislike them (some prefer them for clarity / readability). | ||||||||
▲ | Waterluvian 5 days ago | parent [-] | |||||||
This is where I think linters can shine as educational tools. Underline either as an error and you’ve taught someone something that’s actually quite tricky to discover on your own. Similar to all the times I defensively str(something) in Python to find that “oh that has __str__ called on it anyways.” | ||||||||
|