Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various fixes #91

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading