Skip to content

Commit cc35dcf

Browse files
committed
v0.3.41 release
1 parent 6de297b commit cc35dcf

25 files changed

+173
-163
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ The format is based on [Keep a Changelog]. This project adheres to [Semantic Ver
66

77
---
88

9+
## 0.3.41 [2025-03-23]
10+
11+
### Fixed
12+
13+
- Compatibility with the latest release of `deranged`. This fix is permanent and covers future
14+
similar changes upstream.
15+
916
## 0.3.40 [2025-03-18]
1017

1118
### Added

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ resolver = "2"
55

66
[workspace.dependencies]
77
time-core = { path = "time-core", version = "=0.1.4" }
8-
time-macros = { path = "time-macros", version = "=0.2.21" }
8+
time-macros = { path = "time-macros", version = "=0.2.22" }
99

1010
criterion = { version = "0.5.1", default-features = false }
1111
deranged = { version = "0.4.0", default-features = false, features = [
@@ -102,13 +102,14 @@ alloc-instead-of-core = "deny"
102102
std-instead-of-core = "deny"
103103
undocumented-unsafe-blocks = "deny"
104104

105-
missing-docs-in-private-items = "warn"
106105
all = { level = "warn", priority = -1 }
106+
as-underscore = "warn"
107107
dbg-macro = "warn"
108108
decimal-literal-representation = "warn"
109109
explicit-auto-deref = "warn"
110110
get-unwrap = "warn"
111111
manual-let-else = "warn"
112+
missing-docs-in-private-items = "warn"
112113
missing-enforced-import-renames = "warn"
113114
nursery = { level = "warn", priority = -1 }
114115
obfuscated-if-else = "warn"

time-macros/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "time-macros"
3-
version = "0.2.21"
3+
version = "0.2.22"
44
authors = ["Jacob Pratt <[email protected]>", "Time contributors"]
55
edition = "2021"
66
rust-version = "1.67.1"

time-macros/src/format_description/ast.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,9 @@ fn parse_component<'a, I: Iterator<Item = Result<lexer::Token<'a>, Error>>, cons
210210

211211
modifiers.push(Modifier {
212212
_leading_whitespace: unused(whitespace),
213-
key: key.spanned(span.shrink_to_before(colon_index as _)),
214-
_colon: unused(span.start.offset(colon_index as _)),
215-
value: value.spanned(span.shrink_to_after(colon_index as _)),
213+
key: key.spanned(span.shrink_to_before(colon_index as u32)),
214+
_colon: unused(span.start.offset(colon_index as u32)),
215+
value: value.spanned(span.shrink_to_after(colon_index as u32)),
216216
});
217217
};
218218

time-macros/src/time.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ pub(crate) fn parse(chars: &mut Peekable<token_stream::IntoIter>) -> Result<Time
8787
span_start: Some(minute_span),
8888
span_end: Some(minute_span),
8989
})
90-
} else if second >= Second::per(Minute) as _ {
90+
} else if second >= Second::per(Minute) as f64 {
9191
Err(Error::InvalidComponent {
9292
name: "second",
9393
value: second.to_string(),
@@ -98,8 +98,8 @@ pub(crate) fn parse(chars: &mut Peekable<token_stream::IntoIter>) -> Result<Time
9898
Ok(Time {
9999
hour,
100100
minute,
101-
second: second.trunc() as _,
102-
nanosecond: (second.fract() * Nanosecond::per(Second) as f64).round() as _,
101+
second: second.trunc() as u8,
102+
nanosecond: (second.fract() * Nanosecond::per(Second) as f64).round() as u32,
103103
})
104104
}
105105
}

time/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "time"
3-
version = "0.3.40"
3+
version = "0.3.41"
44
authors = ["Jacob Pratt <[email protected]>", "Time contributors"]
55
edition = "2021"
66
rust-version = "1.67.1"

time/src/date.rs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ impl Date {
141141
return Err(error::ComponentRange {
142142
name: "day",
143143
minimum: 1,
144-
maximum: month.length(year) as _,
145-
value: day as _,
144+
maximum: month.length(year) as i64,
145+
value: day as i64,
146146
conditional_message: Some("for the given month and year"),
147147
});
148148
}
@@ -179,8 +179,8 @@ impl Date {
179179
return Err(error::ComponentRange {
180180
name: "ordinal",
181181
minimum: 1,
182-
maximum: days_in_year(year) as _,
183-
value: ordinal as _,
182+
maximum: days_in_year(year) as i64,
183+
value: ordinal as i64,
184184
conditional_message: Some("for the given year"),
185185
});
186186
}
@@ -216,8 +216,8 @@ impl Date {
216216
return Err(error::ComponentRange {
217217
name: "week",
218218
minimum: 1,
219-
maximum: weeks_in_year(year) as _,
220-
value: week as _,
219+
maximum: weeks_in_year(year) as i64,
220+
value: week as i64,
221221
conditional_message: Some("for the given year"),
222222
});
223223
}
@@ -252,7 +252,7 @@ impl Date {
252252
}
253253
} else {
254254
// Safety: `ordinal` is not zero.
255-
unsafe { Self::__from_ordinal_date_unchecked(year, ordinal as _) }
255+
unsafe { Self::__from_ordinal_date_unchecked(year, ordinal as u16) }
256256
})
257257
}
258258

@@ -316,7 +316,7 @@ impl Date {
316316

317317
// Safety: `ordinal` is not zero and `is_leap_year` is correct, so long as the Julian day
318318
// number is in range.
319-
unsafe { Self::from_parts(y_g, is_leap_year, ordinal as _) }
319+
unsafe { Self::from_parts(y_g, is_leap_year, ordinal as u16) }
320320
}
321321

322322
/// Whether `is_leap_year(self.year())` is `true`.
@@ -391,7 +391,7 @@ impl Date {
391391
let ordinal = ordinal - ordinal_adj;
392392
let month = (ordinal * 268 + 8031) >> 13;
393393
let days_in_preceding_months = (month * 3917 - 3866) >> 7;
394-
(ordinal - days_in_preceding_months) as _
394+
(ordinal - days_in_preceding_months) as u8
395395
}
396396

397397
/// Get the day of the year.
@@ -404,14 +404,14 @@ impl Date {
404404
/// assert_eq!(date!(2019-12-31).ordinal(), 365);
405405
/// ```
406406
pub const fn ordinal(self) -> u16 {
407-
(self.value.get() & 0x1FF) as _
407+
(self.value.get() & 0x1FF) as u16
408408
}
409409

410410
/// Get the ISO 8601 year and week number.
411411
pub(crate) const fn iso_year_week(self) -> (i32, u8) {
412412
let (year, ordinal) = self.to_ordinal_date();
413413

414-
match ((ordinal + 10 - self.weekday().number_from_monday() as u16) / 7) as _ {
414+
match ((ordinal + 10 - self.weekday().number_from_monday() as u16) / 7) as u8 {
415415
0 => (year - 1, weeks_in_year(year - 1)),
416416
53 if weeks_in_year(year) == 52 => (year + 1, 1),
417417
week => (year, week),
@@ -446,7 +446,7 @@ impl Date {
446446
/// assert_eq!(date!(2021-01-01).sunday_based_week(), 0);
447447
/// ```
448448
pub const fn sunday_based_week(self) -> u8 {
449-
((self.ordinal() as i16 - self.weekday().number_days_from_sunday() as i16 + 6) / 7) as _
449+
((self.ordinal() as i16 - self.weekday().number_days_from_sunday() as i16 + 6) / 7) as u8
450450
}
451451

452452
/// Get the week number where week 1 begins on the first Monday.
@@ -461,7 +461,7 @@ impl Date {
461461
/// assert_eq!(date!(2021-01-01).monday_based_week(), 0);
462462
/// ```
463463
pub const fn monday_based_week(self) -> u8 {
464-
((self.ordinal() as i16 - self.weekday().number_days_from_monday() as i16 + 6) / 7) as _
464+
((self.ordinal() as i16 - self.weekday().number_days_from_monday() as i16 + 6) / 7) as u8
465465
}
466466

467467
/// Get the year, month, and day.
@@ -529,7 +529,7 @@ impl Date {
529529
let (year, ordinal) = self.to_ordinal_date();
530530
let weekday = self.weekday();
531531

532-
match ((ordinal + 10 - weekday.number_from_monday() as u16) / 7) as _ {
532+
match ((ordinal + 10 - weekday.number_from_monday() as u16) / 7) as u8 {
533533
0 => (year - 1, weeks_in_year(year - 1), weekday),
534534
53 if weeks_in_year(year) == 52 => (year + 1, 1, weekday),
535535
week => (year, week, weekday),
@@ -779,7 +779,7 @@ impl Date {
779779
return None;
780780
}
781781

782-
let julian_day = const_try_opt!(self.to_julian_day().checked_add(whole_days as _));
782+
let julian_day = const_try_opt!(self.to_julian_day().checked_add(whole_days as i32));
783783
if let Ok(date) = Self::from_julian_day(julian_day) {
784784
Some(date)
785785
} else {
@@ -822,7 +822,7 @@ impl Date {
822822
return None;
823823
}
824824

825-
let julian_day = const_try_opt!(self.to_julian_day().checked_add(whole_days as _));
825+
let julian_day = const_try_opt!(self.to_julian_day().checked_add(whole_days as i32));
826826
if let Ok(date) = Self::from_julian_day(julian_day) {
827827
Some(date)
828828
} else {
@@ -867,7 +867,7 @@ impl Date {
867867
return None;
868868
}
869869

870-
let julian_day = const_try_opt!(self.to_julian_day().checked_sub(whole_days as _));
870+
let julian_day = const_try_opt!(self.to_julian_day().checked_sub(whole_days as i32));
871871
if let Ok(date) = Self::from_julian_day(julian_day) {
872872
Some(date)
873873
} else {
@@ -910,7 +910,7 @@ impl Date {
910910
return None;
911911
}
912912

913-
let julian_day = const_try_opt!(self.to_julian_day().checked_sub(whole_days as _));
913+
let julian_day = const_try_opt!(self.to_julian_day().checked_sub(whole_days as i32));
914914
if let Ok(date) = Self::from_julian_day(julian_day) {
915915
Some(date)
916916
} else {
@@ -1141,8 +1141,8 @@ impl Date {
11411141
return Err(error::ComponentRange {
11421142
name: "day",
11431143
minimum: 1,
1144-
maximum: self.month().length(self.year()) as _,
1145-
value: day as _,
1144+
maximum: self.month().length(self.year()) as i64,
1145+
value: day as i64,
11461146
conditional_message: Some("for the given month and year"),
11471147
});
11481148
}
@@ -1152,7 +1152,7 @@ impl Date {
11521152
Ok(unsafe {
11531153
Self::__from_ordinal_date_unchecked(
11541154
self.year(),
1155-
(self.ordinal() as i16 - self.day() as i16 + day as i16) as _,
1155+
(self.ordinal() as i16 - self.day() as i16 + day as i16) as u16,
11561156
)
11571157
})
11581158
}
@@ -1174,8 +1174,8 @@ impl Date {
11741174
return Err(error::ComponentRange {
11751175
name: "ordinal",
11761176
minimum: 1,
1177-
maximum: days_in_year(self.year()) as _,
1178-
value: ordinal as _,
1177+
maximum: days_in_year(self.year()) as i64,
1178+
value: ordinal as i64,
11791179
conditional_message: Some("for the given year"),
11801180
});
11811181
}

0 commit comments

Comments
 (0)