mirror of
https://github.com/chronotope/chrono.git
synced 2025-10-01 06:52:15 +00:00
Remove Not impls for WeekdaySet and Weekday
This commit is contained in:
parent
cac4e8cf8d
commit
4094865116
@ -1,7 +1,6 @@
|
|||||||
use core::{
|
use core::{
|
||||||
fmt::{self, Debug},
|
fmt::{self, Debug},
|
||||||
iter::FusedIterator,
|
iter::FusedIterator,
|
||||||
ops::Not,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::Weekday;
|
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 {
|
impl FromIterator<Weekday> for WeekdaySet {
|
||||||
fn from_iter<T: IntoIterator<Item = Weekday>>(iter: T) -> Self {
|
fn from_iter<T: IntoIterator<Item = Weekday>>(iter: T) -> Self {
|
||||||
iter.into_iter().map(Self::single).fold(Self::EMPTY, Self::union)
|
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)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::Weekday;
|
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 `split_at` on all possible arguments.
|
||||||
#[test]
|
#[test]
|
||||||
fn split_at_is_equivalent_to_iterating() {
|
fn split_at_is_equivalent_to_iterating() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user