mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 19:22:26 +00:00
Lots of clippy appeasement
This commit is contained in:
@@ -15,7 +15,6 @@ sha2 = { workspace = true }
|
||||
ical = { workspace = true }
|
||||
chrono = { workspace = true }
|
||||
regex = { workspace = true }
|
||||
lazy_static = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
chrono-tz = { workspace = true }
|
||||
|
||||
@@ -14,7 +14,8 @@ pub struct Addressbook {
|
||||
}
|
||||
|
||||
impl Addressbook {
|
||||
#[must_use] pub fn format_synctoken(&self) -> String {
|
||||
#[must_use]
|
||||
pub fn format_synctoken(&self) -> String {
|
||||
format_synctoken(self.synctoken)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,9 +53,9 @@ impl<S: Clone, AP: AuthenticationProvider> Clone for AuthenticationMiddleware<S,
|
||||
}
|
||||
}
|
||||
|
||||
impl<S: Clone, AP: AuthenticationProvider> Service<Request> for AuthenticationMiddleware<S, AP>
|
||||
impl<S, AP: AuthenticationProvider> Service<Request> for AuthenticationMiddleware<S, AP>
|
||||
where
|
||||
S: Service<Request, Response = Response> + Send + 'static,
|
||||
S: Service<Request, Response = Response> + Send + Clone + 'static,
|
||||
S::Future: Send + 'static,
|
||||
{
|
||||
type Response = S::Response;
|
||||
|
||||
@@ -35,7 +35,8 @@ impl Principal {
|
||||
/// Returns true if the user is either
|
||||
/// - the principal itself
|
||||
/// - has full access to the prinicpal (is member)
|
||||
#[must_use] pub fn is_principal(&self, principal: &str) -> bool {
|
||||
#[must_use]
|
||||
pub fn is_principal(&self, principal: &str) -> bool {
|
||||
if self.id == principal {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,8 @@ impl TryFrom<&str> for PrincipalType {
|
||||
}
|
||||
|
||||
impl PrincipalType {
|
||||
#[must_use] pub const fn as_str(&self) -> &'static str {
|
||||
#[must_use]
|
||||
pub const fn as_str(&self) -> &'static str {
|
||||
match self {
|
||||
Self::Individual => "INDIVIDUAL",
|
||||
Self::Group => "GROUP",
|
||||
|
||||
@@ -32,17 +32,20 @@ pub struct Calendar {
|
||||
}
|
||||
|
||||
impl Calendar {
|
||||
#[must_use] pub fn format_synctoken(&self) -> String {
|
||||
#[must_use]
|
||||
pub fn format_synctoken(&self) -> String {
|
||||
format_synctoken(self.synctoken)
|
||||
}
|
||||
|
||||
#[must_use] pub fn get_timezone(&self) -> Option<chrono_tz::Tz> {
|
||||
#[must_use]
|
||||
pub fn get_timezone(&self) -> Option<chrono_tz::Tz> {
|
||||
self.timezone_id
|
||||
.as_ref()
|
||||
.and_then(|tzid| chrono_tz::Tz::from_str(tzid).ok())
|
||||
}
|
||||
|
||||
#[must_use] pub fn get_vtimezone(&self) -> Option<&'static str> {
|
||||
#[must_use]
|
||||
pub fn get_vtimezone(&self) -> Option<&'static str> {
|
||||
self.timezone_id
|
||||
.as_ref()
|
||||
.and_then(|tzid| vtimezones_rs::VTIMEZONES.get(tzid).copied())
|
||||
|
||||
@@ -20,6 +20,7 @@ impl CombinedCalendarStore {
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn with_store<CS: PrefixedCalendarStore>(mut self, store: Arc<CS>) -> Self {
|
||||
let store: Arc<dyn CalendarStore> = store;
|
||||
self.stores.insert(CS::PREFIX, store);
|
||||
@@ -30,8 +31,7 @@ impl CombinedCalendarStore {
|
||||
self.stores
|
||||
.iter()
|
||||
.find(|&(prefix, _store)| id.starts_with(prefix))
|
||||
.map(|(_prefix, store)| store.clone())
|
||||
.unwrap_or(self.default.clone())
|
||||
.map_or_else(|| self.default.clone(), |(_prefix, store)| store.clone())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,8 @@ pub enum Error {
|
||||
}
|
||||
|
||||
impl Error {
|
||||
#[must_use] pub const fn status_code(&self) -> StatusCode {
|
||||
#[must_use]
|
||||
pub const fn status_code(&self) -> StatusCode {
|
||||
match self {
|
||||
Self::NotFound => StatusCode::NOT_FOUND,
|
||||
Self::AlreadyExists => StatusCode::CONFLICT,
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
const SYNC_NAMESPACE: &str = "github.com/lennart-k/rustical/ns/";
|
||||
|
||||
#[must_use] pub fn format_synctoken(synctoken: i64) -> String {
|
||||
#[must_use]
|
||||
pub fn format_synctoken(synctoken: i64) -> String {
|
||||
format!("{SYNC_NAMESPACE}{synctoken}")
|
||||
}
|
||||
|
||||
#[must_use] pub fn parse_synctoken(synctoken: &str) -> Option<i64> {
|
||||
#[must_use]
|
||||
pub fn parse_synctoken(synctoken: &str) -> Option<i64> {
|
||||
if !synctoken.starts_with(SYNC_NAMESPACE) {
|
||||
return None;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user