Implement bit and set_bit for integral types. by bjoernager · Pull Request #147696 · rust-lang/rust (original) (raw)
Not sure if this detail was discussed on the ACP, but the name
set_bitreads to me like its signature should be(&mut self, i: u32, value: bool) -> ()and not (as implemented here)(self, i: u32, value: bool) -> Self, which I'd callwith_bit_setorwith_bit.
with_set_bit is unfortunately quite a mouthful, and it can be mitigated by just adding #[must_use] to set_bit to indicate that it has no effects apart from its return value, which should avoid any accidental misuses.
Not sure if this detail was discussed on the ACP, but the name
set_bitreads to me like its signature should be(&mut self, i: u32, value: bool) -> ()and not (as implemented here)(self, i: u32, value: bool) -> Self, which I'd callwith_bit_setorwith_bit.
In the meeting we were specifically considering the version that takes a value: bool parameter.