Skip to content

Commit

Permalink
Merge pull request #91 from xfbs/cleanup
Browse files Browse the repository at this point in the history
Various fixes
  • Loading branch information
jeffparsons authored Feb 7, 2024
2 parents 2cc8ce9 + fa9a209 commit 9a67f56
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/roster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fn main() {
let mut roster = RangeMap::new();

// Set up initial roster.
let start_of_roster = Utc.ymd(2019, 1, 7);
let start_of_roster = Utc.with_ymd_and_hms(2019, 1, 7, 0, 0, 0).unwrap();
let mut week_start = start_of_roster;
for _ in 0..3 {
for person in &people {
Expand Down
3 changes: 2 additions & 1 deletion src/inclusive_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ impl<K: Ord + Clone + StepLite, V: Eq + Clone, const N: usize> From<[(RangeInclu
#[macro_export]
macro_rules! range_inclusive_map {
($($k:expr => $v:expr),* $(,)?) => {{
<$crate::RangeInclusiveMap<_, _> as core::iter::FromIterator<_>>::from_iter([$(($k, $v),)*])
$crate::RangeInclusiveMap::from([$(($k, $v)),*])
}};
}

Expand Down Expand Up @@ -1039,6 +1039,7 @@ mod tests {

#[test]
fn test_macro() {
assert_eq!(range_inclusive_map![], RangeInclusiveMap::<i64, i64>::new());
assert_eq!(
range_inclusive_map!(0..=100 => "abc", 100..=200 => "def", 200..=300 => "ghi"),
[(0..=100, "abc"), (100..=200, "def"), (200..=300, "ghi")]
Expand Down
3 changes: 2 additions & 1 deletion src/inclusive_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ impl<T: Ord + Clone + StepLite, const N: usize> From<[RangeInclusive<T>; N]>
#[macro_export]
macro_rules! range_inclusive_set {
($($range:expr),* $(,)?) => {{
<$crate::RangeInclusiveSet<_> as core::iter::FromIterator<_>>::from_iter([$($range,)*])
$crate::RangeInclusiveSet::from([$($range),*])
}};
}

Expand Down Expand Up @@ -561,6 +561,7 @@ mod tests {

#[test]
fn test_macro() {
assert_eq!(range_inclusive_set![], RangeInclusiveSet::<i64>::new());
assert_eq!(
range_inclusive_set![0..=100, 200..=300, 400..=500],
[0..=100, 200..=300, 400..=500].iter().cloned().collect(),
Expand Down
3 changes: 2 additions & 1 deletion src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ impl<K: Ord + Clone, V: Eq + Clone, const N: usize> From<[(Range<K>, V); N]> for
#[macro_export]
macro_rules! range_map {
($($k:expr => $v:expr),* $(,)?) => {{
<$crate::RangeMap<_, _> as core::iter::FromIterator<_>>::from_iter([$(($k, $v),)*])
$crate::RangeMap::from([$(($k, $v)),*])
}};
}

Expand Down Expand Up @@ -924,6 +924,7 @@ mod tests {

#[test]
fn test_macro() {
assert_eq!(range_map![], RangeMap::<i64, i64>::new());
assert_eq!(
range_map!(0..100 => "abc", 100..200 => "def", 200..300 => "ghi"),
[(0..100, "abc"), (100..200, "def"), (200..300, "ghi")]
Expand Down
2 changes: 1 addition & 1 deletion src/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl<T: Ord> RangeOrder for RangeInclusive<T> {
}

fn order_end(&self, other: &Self) -> Ordering {
self.end().cmp(&other.end())
self.end().cmp(other.end())
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ impl<T: Ord + Clone, const N: usize> From<[Range<T>; N]> for RangeSet<T> {
#[macro_export]
macro_rules! range_set {
($($range:expr),* $(,)?) => {{
<$crate::RangeSet<_> as core::iter::FromIterator<_>>::from_iter([$($range,)*])
$crate::RangeSet::from([$($range),*])
}};
}

Expand Down Expand Up @@ -525,6 +525,7 @@ mod tests {

#[test]
fn test_macro() {
assert_eq!(range_set![], RangeSet::<i64>::new());
assert_eq!(
range_set![0..100, 200..300, 400..500],
[0..100, 200..300, 400..500].iter().cloned().collect(),
Expand Down

0 comments on commit 9a67f56

Please sign in to comment.