Hacker News new | ask | show | jobs
by pasteleft 23 days ago
I think they made it to reduce closure usage.

  vec.map(|x| !x);

  vec.map(bool::toggle);
1 comments

No, these aren't equivalent: the second line mutates the iterated-over values, while the first doesn't. And the first line returns an iterator over bool, while the second returns an iterator over ().