mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 22:52:22 +00:00
Lots of clippy appeasement
This commit is contained in:
@@ -141,10 +141,12 @@ impl SqliteAddressbookStore {
|
||||
if use_trashbin {
|
||||
sqlx::query!(
|
||||
r#"UPDATE addressbooks SET deleted_at = datetime() WHERE (principal, id) = (?, ?)"#,
|
||||
principal, addressbook_id
|
||||
principal,
|
||||
addressbook_id
|
||||
)
|
||||
.execute(executor)
|
||||
.await.map_err(crate::Error::from)?;
|
||||
.await
|
||||
.map_err(crate::Error::from)?;
|
||||
} else {
|
||||
sqlx::query!(
|
||||
r#"DELETE FROM addressbooks WHERE (principal, id) = (?, ?)"#,
|
||||
@@ -203,9 +205,7 @@ impl SqliteAddressbookStore {
|
||||
let mut objects = vec![];
|
||||
let mut deleted_objects = vec![];
|
||||
|
||||
let new_synctoken = changes
|
||||
.last()
|
||||
.map_or(0, |&Row { synctoken, .. }| synctoken);
|
||||
let new_synctoken = changes.last().map_or(0, |&Row { synctoken, .. }| synctoken);
|
||||
|
||||
for Row { object_id, .. } in changes {
|
||||
match Self::_get_object(&mut *conn, principal, addressbook_id, &object_id, false).await
|
||||
|
||||
@@ -213,21 +213,25 @@ impl SqliteCalendarStore {
|
||||
id: &str,
|
||||
use_trashbin: bool,
|
||||
) -> Result<(), Error> {
|
||||
if use_trashbin { sqlx::query!(
|
||||
r#"UPDATE calendars SET deleted_at = datetime() WHERE (principal, id) = (?, ?)"#,
|
||||
principal,
|
||||
id
|
||||
)
|
||||
.execute(executor)
|
||||
.await
|
||||
.map_err(crate::Error::from)? } else { sqlx::query!(
|
||||
r#"DELETE FROM calendars WHERE (principal, id) = (?, ?)"#,
|
||||
principal,
|
||||
id
|
||||
)
|
||||
.execute(executor)
|
||||
.await
|
||||
.map_err(crate::Error::from)? };
|
||||
if use_trashbin {
|
||||
sqlx::query!(
|
||||
r#"UPDATE calendars SET deleted_at = datetime() WHERE (principal, id) = (?, ?)"#,
|
||||
principal,
|
||||
id
|
||||
)
|
||||
.execute(executor)
|
||||
.await
|
||||
.map_err(crate::Error::from)?
|
||||
} else {
|
||||
sqlx::query!(
|
||||
r#"DELETE FROM calendars WHERE (principal, id) = (?, ?)"#,
|
||||
principal,
|
||||
id
|
||||
)
|
||||
.execute(executor)
|
||||
.await
|
||||
.map_err(crate::Error::from)?
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -476,9 +480,7 @@ impl SqliteCalendarStore {
|
||||
let mut objects = vec![];
|
||||
let mut deleted_objects = vec![];
|
||||
|
||||
let new_synctoken = changes
|
||||
.last()
|
||||
.map_or(0, |&Row { synctoken, .. }| synctoken);
|
||||
let new_synctoken = changes.last().map_or(0, |&Row { synctoken, .. }| synctoken);
|
||||
|
||||
for Row { object_id, .. } in changes {
|
||||
match Self::_get_object(&mut *conn, principal, cal_id, &object_id, false).await {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#![warn(clippy::all, clippy::pedantic, clippy::nursery)]
|
||||
#![allow(clippy::missing_errors_doc)]
|
||||
pub use error::Error;
|
||||
use serde::Serialize;
|
||||
use sqlx::{Pool, Sqlite, SqlitePool, sqlite::SqliteConnectOptions};
|
||||
@@ -26,7 +27,8 @@ pub struct SqliteStore {
|
||||
}
|
||||
|
||||
impl SqliteStore {
|
||||
#[must_use] pub const fn new(db: SqlitePool) -> Self {
|
||||
#[must_use]
|
||||
pub const fn new(db: SqlitePool) -> Self {
|
||||
Self { db }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,9 +195,8 @@ impl AuthenticationProvider for SqlitePrincipalStore {
|
||||
Some(user) => user,
|
||||
None => return Ok(None),
|
||||
};
|
||||
let password = match &user.password {
|
||||
Some(password) => password,
|
||||
None => return Ok(None),
|
||||
let Some(password) = &user.password else {
|
||||
return Ok(None);
|
||||
};
|
||||
|
||||
if password_auth::verify_password(password_input, password.as_ref()).is_ok() {
|
||||
|
||||
Reference in New Issue
Block a user