Lots of clippy appeasement

This commit is contained in:
Lennart
2025-10-27 20:12:21 +01:00
parent 0d071d3b92
commit 86cf490fa9
84 changed files with 413 additions and 435 deletions

View File

@@ -15,7 +15,8 @@ pub struct EventObject {
}
impl EventObject {
#[must_use] pub fn get_uid(&self) -> &str {
#[must_use]
pub fn get_uid(&self) -> &str {
self.event.get_uid()
}
@@ -70,9 +71,9 @@ impl EventObject {
for prop in &self.event.properties {
rrule_set = match prop.name.as_str() {
"RRULE" => {
let rrule = RRule::from_str(prop.value.as_ref().ok_or(Error::RRuleError(
rrule::ParseError::MissingDateGenerationRules.into(),
))?)?
let rrule = RRule::from_str(prop.value.as_ref().ok_or_else(|| {
Error::RRuleError(rrule::ParseError::MissingDateGenerationRules.into())
})?)?
.validate(dtstart)
.unwrap();
rrule_set.rrule(rrule)
@@ -120,8 +121,8 @@ impl EventObject {
date.format()
};
for _override in overrides {
if let Some(override_id) = &_override
for ev_override in overrides {
if let Some(override_id) = &ev_override
.event
.get_recurrence_id()
.as_ref()
@@ -131,7 +132,7 @@ impl EventObject {
{
// We have an override for this occurence
//
events.push(_override.event.clone());
events.push(ev_override.event.clone());
continue 'recurrence;
}
}
@@ -185,7 +186,7 @@ mod tests {
use crate::CalendarObject;
use ical::generator::Emitter;
const ICS: &str = r#"BEGIN:VCALENDAR
const ICS: &str = r"BEGIN:VCALENDAR
CALSCALE:GREGORIAN
VERSION:2.0
BEGIN:VTIMEZONE
@@ -203,7 +204,7 @@ SUMMARY:weekly stuff
TRANSP:OPAQUE
RRULE:FREQ=WEEKLY;COUNT=4;INTERVAL=2;BYDAY=TU,TH,SU
END:VEVENT
END:VCALENDAR"#;
END:VCALENDAR";
const EXPANDED: [&str; 4] = [
"BEGIN:VEVENT\r
@@ -251,13 +252,7 @@ END:VEVENT\r\n",
#[test]
fn test_expand_recurrence() {
let event = CalendarObject::from_ics(ICS.to_string()).unwrap();
let (event, overrides) = if let crate::CalendarObjectComponent::Event(
main_event,
overrides,
) = event.get_data()
{
(main_event, overrides)
} else {
let crate::CalendarObjectComponent::Event(event, overrides) = event.get_data() else {
panic!()
};