clippy appeasement

This commit is contained in:
Lennart
2025-08-30 11:56:58 +02:00
parent 96b63848f0
commit 76c03fa4d4
8 changed files with 48 additions and 53 deletions

View File

@@ -116,19 +116,17 @@ impl CompFilterElement {
// TODO: Implement prop-filter (and comp-filter?) at some point // TODO: Implement prop-filter (and comp-filter?) at some point
if let Some(time_range) = &self.time_range { if let Some(time_range) = &self.time_range {
if let Some(start) = &time_range.start { if let Some(start) = &time_range.start
if let Some(last_occurence) = cal_object.get_last_occurence().unwrap_or(None) { && let Some(last_occurence) = cal_object.get_last_occurence().unwrap_or(None)
if start.deref() > &last_occurence.utc() { && start.deref() > &last_occurence.utc()
return false; {
} return false;
};
} }
if let Some(end) = &time_range.end { if let Some(end) = &time_range.end
if let Some(first_occurence) = cal_object.get_first_occurence().unwrap_or(None) { && let Some(first_occurence) = cal_object.get_first_occurence().unwrap_or(None)
if end.deref() < &first_occurence.utc() { && end.deref() < &first_occurence.utc()
return false; {
} return false;
};
} }
} }
true true
@@ -156,15 +154,15 @@ impl From<&FilterElement> for CalendarQuery {
for comp_filter in comp_filter_vcalendar.comp_filter.iter() { for comp_filter in comp_filter_vcalendar.comp_filter.iter() {
// A calendar object cannot contain both VEVENT and VTODO, so we only have to handle // A calendar object cannot contain both VEVENT and VTODO, so we only have to handle
// whatever we get first // whatever we get first
if matches!(comp_filter.name.as_str(), "VEVENT" | "VTODO") { if matches!(comp_filter.name.as_str(), "VEVENT" | "VTODO")
if let Some(time_range) = &comp_filter.time_range { && let Some(time_range) = &comp_filter.time_range
let start = time_range.start.as_ref().map(|start| start.date_naive()); {
let end = time_range.end.as_ref().map(|end| end.date_naive()); let start = time_range.start.as_ref().map(|start| start.date_naive());
return CalendarQuery { let end = time_range.end.as_ref().map(|end| end.date_naive());
time_start: start, return CalendarQuery {
time_end: end, time_start: start,
}; time_end: end,
} };
} }
} }
Default::default() Default::default()

View File

@@ -79,5 +79,5 @@ async fn test_propfind() {
) )
.unwrap(); .unwrap();
let output = response.serialize_to_string().unwrap(); let _output = response.serialize_to_string().unwrap();
} }

View File

@@ -35,10 +35,8 @@ impl XmlSerialize for TagList {
if let Some(qname) = &qname { if let Some(qname) = &qname {
let mut bytes_start = BytesStart::from(qname.to_owned()); let mut bytes_start = BytesStart::from(qname.to_owned());
if !has_prefix { if !has_prefix && let Some(ns) = &ns {
if let Some(ns) = &ns { bytes_start.push_attribute((b"xmlns".as_ref(), ns.as_ref()));
bytes_start.push_attribute((b"xmlns".as_ref(), ns.as_ref()));
}
} }
writer.write_event(Event::Start(bytes_start))?; writer.write_event(Event::Start(bytes_start))?;
} }

View File

@@ -13,6 +13,7 @@ use tower::Service;
#[derive(Clone, RustEmbed, Default)] #[derive(Clone, RustEmbed, Default)]
#[folder = "public/assets"] #[folder = "public/assets"]
#[allow(dead_code)] // Since this is not used with the frontend-dev feature
pub struct Assets; pub struct Assets;
#[derive(Clone, Default)] #[derive(Clone, Default)]

View File

@@ -192,20 +192,19 @@ pub async fn route_get_oidc_callback<US: UserStore + Clone>(
.await .await
.map_err(|e| OidcError::UserInfo(e.to_string()))?; .map_err(|e| OidcError::UserInfo(e.to_string()))?;
if let Some(require_group) = &oidc_config.require_group { if let Some(require_group) = &oidc_config.require_group
if !user_info_claims && !user_info_claims
.additional_claims() .additional_claims()
.groups .groups
.clone() .clone()
.unwrap_or_default() .unwrap_or_default()
.contains(require_group) .contains(require_group)
{ {
return Ok(( return Ok((
StatusCode::UNAUTHORIZED, StatusCode::UNAUTHORIZED,
"User is not in an authorized group to use RustiCal", "User is not in an authorized group to use RustiCal",
) )
.into_response()); .into_response());
}
} }
let user_id = match oidc_config.claim_userid { let user_id = match oidc_config.claim_userid {

View File

@@ -72,12 +72,11 @@ where
let mut inner = self.inner.clone(); let mut inner = self.inner.clone();
Box::pin(async move { Box::pin(async move {
if let Some(session) = request.extensions().get::<Session>() { if let Some(session) = request.extensions().get::<Session>()
if let Ok(Some(user_id)) = session.get::<String>("user").await { && let Ok(Some(user_id)) = session.get::<String>("user").await
if let Ok(Some(user)) = ap.get_principal(&user_id).await { && let Ok(Some(user)) = ap.get_principal(&user_id).await
request.extensions_mut().insert(user); {
} request.extensions_mut().insert(user);
}
} }
if let Some(auth) = auth_header { if let Some(auth) = auth_header {

View File

@@ -433,14 +433,14 @@ impl AddressbookStore for SqliteAddressbookStore {
Self::_delete_addressbook(&mut *tx, principal, addressbook_id, use_trashbin).await?; Self::_delete_addressbook(&mut *tx, principal, addressbook_id, use_trashbin).await?;
tx.commit().await.map_err(crate::Error::from)?; tx.commit().await.map_err(crate::Error::from)?;
if let Some(addressbook) = addressbook { if let Some(addressbook) = addressbook
if let Err(err) = self.sender.try_send(CollectionOperation { && let Err(err) = self.sender.try_send(CollectionOperation {
data: CollectionOperationInfo::Delete, data: CollectionOperationInfo::Delete,
topic: addressbook.push_topic, topic: addressbook.push_topic,
}) { })
error!("Push notification about deleted addressbook failed: {err}"); {
}; error!("Push notification about deleted addressbook failed: {err}");
} };
Ok(()) Ok(())
} }

View File

@@ -554,14 +554,14 @@ impl CalendarStore for SqliteCalendarStore {
Self::_delete_calendar(&mut *tx, principal, id, use_trashbin).await?; Self::_delete_calendar(&mut *tx, principal, id, use_trashbin).await?;
tx.commit().await.map_err(crate::Error::from)?; tx.commit().await.map_err(crate::Error::from)?;
if let Some(cal) = cal { if let Some(cal) = cal
if let Err(err) = self.sender.try_send(CollectionOperation { && let Err(err) = self.sender.try_send(CollectionOperation {
data: CollectionOperationInfo::Delete, data: CollectionOperationInfo::Delete,
topic: cal.push_topic, topic: cal.push_topic,
}) { })
error!("Push notification about deleted calendar failed: {err}"); {
}; error!("Push notification about deleted calendar failed: {err}");
} };
Ok(()) Ok(())
} }