Skip to content

Commit

Permalink
Apply suggestions from clippy 1.83
Browse files Browse the repository at this point in the history
  • Loading branch information
djc authored and pitdicker committed Nov 29, 2024
1 parent 1c7567b commit 1456fa0
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 19 deletions.
12 changes: 6 additions & 6 deletions src/datetime/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl<Tz: TimeZone> ser::Serialize for DateTime<Tz> {
inner: &'a DateTime<Tz>,
}

impl<'a, Tz: TimeZone> fmt::Display for FormatIso8601<'a, Tz> {
impl<Tz: TimeZone> fmt::Display for FormatIso8601<'_, Tz> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let naive = self.inner.naive_local();
let offset = self.inner.offset.fix();
Expand All @@ -52,7 +52,7 @@ impl<Tz: TimeZone> ser::Serialize for DateTime<Tz> {

struct DateTimeVisitor;

impl<'de> de::Visitor<'de> for DateTimeVisitor {
impl de::Visitor<'_> for DateTimeVisitor {
type Value = DateTime<FixedOffset>;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down Expand Up @@ -230,7 +230,7 @@ pub mod ts_nanoseconds {
d.deserialize_i64(NanoSecondsTimestampVisitor)
}

impl<'de> de::Visitor<'de> for NanoSecondsTimestampVisitor {
impl de::Visitor<'_> for NanoSecondsTimestampVisitor {
type Value = DateTime<Utc>;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down Expand Up @@ -512,7 +512,7 @@ pub mod ts_microseconds {
d.deserialize_i64(MicroSecondsTimestampVisitor)
}

impl<'de> de::Visitor<'de> for MicroSecondsTimestampVisitor {
impl de::Visitor<'_> for MicroSecondsTimestampVisitor {
type Value = DateTime<Utc>;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down Expand Up @@ -786,7 +786,7 @@ pub mod ts_milliseconds {
d.deserialize_i64(MilliSecondsTimestampVisitor).map(|dt| dt.with_timezone(&Utc))
}

impl<'de> de::Visitor<'de> for MilliSecondsTimestampVisitor {
impl de::Visitor<'_> for MilliSecondsTimestampVisitor {
type Value = DateTime<Utc>;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down Expand Up @@ -1052,7 +1052,7 @@ pub mod ts_seconds {
d.deserialize_i64(SecondsTimestampVisitor)
}

impl<'de> de::Visitor<'de> for SecondsTimestampVisitor {
impl de::Visitor<'_> for SecondsTimestampVisitor {
type Value = DateTime<Utc>;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion src/format/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ const fn internal_fixed(val: InternalInternal) -> Item<'static> {
Item::Fixed(Fixed::Internal(InternalFixed { val }))
}

impl<'a> Item<'a> {
impl Item<'_> {
/// Convert items that contain a reference to the format string into an owned variant.
#[cfg(any(feature = "alloc", feature = "std"))]
pub fn to_owned(self) -> Item<'static> {
Expand Down
3 changes: 1 addition & 2 deletions src/month.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ impl num_traits::FromPrimitive for Month {
/// `Month::from_i64(n: i64)`: | `1` | `2` | ... | `12`
/// ---------------------------| -------------------- | --------------------- | ... | -----
/// ``: | Some(Month::January) | Some(Month::February) | ... | Some(Month::December)
#[inline]
fn from_u64(n: u64) -> Option<Month> {
Self::from_u32(n as u32)
Expand Down Expand Up @@ -279,7 +278,7 @@ mod month_serde {

struct MonthVisitor;

impl<'de> de::Visitor<'de> for MonthVisitor {
impl de::Visitor<'_> for MonthVisitor {
type Value = Month;

fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result {
Expand Down
4 changes: 2 additions & 2 deletions src/naive/date/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2406,7 +2406,7 @@ mod serde {
inner: &'a D,
}

impl<'a, D: fmt::Debug> fmt::Display for FormatWrapped<'a, D> {
impl<D: fmt::Debug> fmt::Display for FormatWrapped<'_, D> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.inner.fmt(f)
}
Expand All @@ -2418,7 +2418,7 @@ mod serde {

struct NaiveDateVisitor;

impl<'de> de::Visitor<'de> for NaiveDateVisitor {
impl de::Visitor<'_> for NaiveDateVisitor {
type Value = NaiveDate;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down
12 changes: 6 additions & 6 deletions src/naive/datetime/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ impl ser::Serialize for NaiveDateTime {
inner: &'a D,
}

impl<'a, D: fmt::Debug> fmt::Display for FormatWrapped<'a, D> {
impl<D: fmt::Debug> fmt::Display for FormatWrapped<'_, D> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.inner.fmt(f)
}
Expand All @@ -27,7 +27,7 @@ impl ser::Serialize for NaiveDateTime {

struct NaiveDateTimeVisitor;

impl<'de> de::Visitor<'de> for NaiveDateTimeVisitor {
impl de::Visitor<'_> for NaiveDateTimeVisitor {
type Value = NaiveDateTime;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down Expand Up @@ -161,7 +161,7 @@ pub mod ts_nanoseconds {

pub(super) struct NanoSecondsTimestampVisitor;

impl<'de> de::Visitor<'de> for NanoSecondsTimestampVisitor {
impl de::Visitor<'_> for NanoSecondsTimestampVisitor {
type Value = NaiveDateTime;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down Expand Up @@ -443,7 +443,7 @@ pub mod ts_microseconds {

pub(super) struct MicroSecondsTimestampVisitor;

impl<'de> de::Visitor<'de> for MicroSecondsTimestampVisitor {
impl de::Visitor<'_> for MicroSecondsTimestampVisitor {
type Value = NaiveDateTime;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down Expand Up @@ -713,7 +713,7 @@ pub mod ts_milliseconds {

pub(super) struct MilliSecondsTimestampVisitor;

impl<'de> de::Visitor<'de> for MilliSecondsTimestampVisitor {
impl de::Visitor<'_> for MilliSecondsTimestampVisitor {
type Value = NaiveDateTime;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down Expand Up @@ -968,7 +968,7 @@ pub mod ts_seconds {

pub(super) struct SecondsTimestampVisitor;

impl<'de> de::Visitor<'de> for SecondsTimestampVisitor {
impl de::Visitor<'_> for SecondsTimestampVisitor {
type Value = NaiveDateTime;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion src/naive/time/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl ser::Serialize for NaiveTime {

struct NaiveTimeVisitor;

impl<'de> de::Visitor<'de> for NaiveTimeVisitor {
impl de::Visitor<'_> for NaiveTimeVisitor {
type Value = NaiveTime;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion src/weekday.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ mod weekday_serde {

struct WeekdayVisitor;

impl<'de> de::Visitor<'de> for WeekdayVisitor {
impl de::Visitor<'_> for WeekdayVisitor {
type Value = Weekday;

fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result {
Expand Down

0 comments on commit 1456fa0

Please sign in to comment.