Remove Not impls for WeekdaySet and Weekday

This commit is contained in:
Dirkjan Ochtman 2025-03-23 09:53:38 +01:00
parent cac4e8cf8d
commit 4094865116

View File

@ -1,7 +1,6 @@
use core::{
fmt::{self, Debug},
iter::FusedIterator,
ops::Not,
};
use crate::Weekday;
@ -419,28 +418,12 @@ impl fmt::Display for WeekdaySet {
}
}
impl Not for WeekdaySet {
type Output = Self;
fn not(self) -> Self::Output {
Self(self.0 ^ 0b0111_1111)
}
}
impl FromIterator<Weekday> for WeekdaySet {
fn from_iter<T: IntoIterator<Item = Weekday>>(iter: T) -> Self {
iter.into_iter().map(Self::single).fold(Self::EMPTY, Self::union)
}
}
impl Not for Weekday {
type Output = WeekdaySet;
fn not(self) -> Self::Output {
!WeekdaySet::single(self)
}
}
#[cfg(test)]
mod tests {
use crate::Weekday;
@ -475,13 +458,6 @@ mod tests {
}
}
#[test]
fn not_operation_preserves_8th_bit_invariant() {
for days in WeekdaySet::iter_all() {
assert_8th_bit_invariant(!days);
}
}
/// Test `split_at` on all possible arguments.
#[test]
fn split_at_is_equivalent_to_iterating() {