Skip to content

Commit

Permalink
refactor: cleanup clippy warning
Browse files Browse the repository at this point in the history
  • Loading branch information
marcantoinem committed Aug 25, 2024
1 parent 7b0669b commit ef7d0bf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ pub trait Component {
///
/// This must be a UTC date-time value.
fn timestamp(&mut self, dt: DateTime<Utc>) -> &mut Self {
self.add_property("DTSTAMP", &format_utc_date_time(dt))
self.add_property("DTSTAMP", format_utc_date_time(dt))
}

/// Gets the [`DTSTAMP`](https://datatracker.ietf.org/doc/html/rfc5545#section-3.8.7.2) property.
Expand All @@ -187,7 +187,7 @@ pub trait Component {
/// Ranges from 0 to 10, larger values will be truncated
fn priority(&mut self, priority: u32) -> &mut Self {
let priority = std::cmp::min(priority, 10);
self.add_property("PRIORITY", &priority.to_string())
self.add_property("PRIORITY", priority.to_string())
}

// /// Add the [`ATTACH`](https://datatracker.ietf.org/doc/html/rfc5545#section-3.8.1.1) property
Expand Down
8 changes: 4 additions & 4 deletions src/components/date_time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub(crate) fn parse_duration(s: &str) -> Option<Duration> {
}

pub(crate) fn naive_date_to_property(date: NaiveDate, key: &str) -> Property {
Property::new(key, &date.format(NAIVE_DATE_FORMAT).to_string())
Property::new(key, date.format(NAIVE_DATE_FORMAT).to_string())
.append_parameter(ValueType::Date)
.done()
}
Expand Down Expand Up @@ -97,11 +97,11 @@ impl CalendarDateTime {
pub(crate) fn to_property(&self, key: &str) -> Property {
match self {
CalendarDateTime::Floating(naive_dt) => {
Property::new(key, &naive_dt.format(NAIVE_DATE_TIME_FORMAT).to_string())
Property::new(key, naive_dt.format(NAIVE_DATE_TIME_FORMAT).to_string())
}
CalendarDateTime::Utc(utc_dt) => Property::new(key, &format_utc_date_time(*utc_dt)),
CalendarDateTime::Utc(utc_dt) => Property::new(key, format_utc_date_time(*utc_dt)),
CalendarDateTime::WithTimezone { date_time, tzid } => {
Property::new(key, &date_time.format(NAIVE_DATE_TIME_FORMAT).to_string())
Property::new(key, date_time.format(NAIVE_DATE_TIME_FORMAT).to_string())
.add_parameter("TZID", tzid)
.done()
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/todo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl Todo {
///
/// Ranges between 0 - 100
pub fn percent_complete(&mut self, percent: u8) -> &mut Self {
self.add_property("PERCENT-COMPLETE", &percent.to_string())
self.add_property("PERCENT-COMPLETE", percent.to_string())
}

/// Gets the [`PERCENT-COMPLETE`](https://datatracker.ietf.org/doc/html/rfc5545#section-3.8.1.8) property.
Expand Down Expand Up @@ -54,7 +54,7 @@ impl Todo {
/// Per [RFC 5545, Section 3.8.2.1](https://tools.ietf.org/html/rfc5545#section-3.8.2.1), this
/// must be a date-time in UTC format.
pub fn completed(&mut self, dt: DateTime<Utc>) -> &mut Self {
self.add_property("COMPLETED", &format_utc_date_time(dt))
self.add_property("COMPLETED", format_utc_date_time(dt))
}

/// Gets the [`COMPLETED`](https://datatracker.ietf.org/doc/html/rfc5545#section-3.8.2.1) property
Expand Down

0 comments on commit ef7d0bf

Please sign in to comment.