Remix.run Logo
▲ pasteleft 2 days ago

I think they made it to reduce closure usage.

  vec.map(|x| !x);

  vec.map(bool::toggle);
▲adwn 2 days ago | parent [-]

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 ().