Fix bug & lint

This commit is contained in:
Andras Schmelczer 2025-07-12 14:46:01 +01:00
parent 0f441e38d8
commit 43ad44d594
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
8 changed files with 11 additions and 23 deletions

View file

@ -124,7 +124,5 @@ impl ClientCursorsWithTimeToLive {
}
}
pub fn is_expired(&self, ttl: Duration) -> bool {
self.last_updated.elapsed() > ttl
}
pub fn is_expired(&self, ttl: Duration) -> bool { self.last_updated.elapsed() > ttl }
}

View file

@ -23,9 +23,7 @@ pub struct StoredDocumentVersion {
}
impl PartialEq<Self> for StoredDocumentVersion {
fn eq(&self, other: &Self) -> bool {
self.vault_update_id == other.vault_update_id
}
fn eq(&self, other: &Self) -> bool { self.vault_update_id == other.vault_update_id }
}
#[derive(TS, Debug, Clone, Serialize)]

View file

@ -179,10 +179,6 @@ async fn shutdown_signal() {
}
}
async fn handle_404() -> impl IntoResponse {
not_found_error(anyhow!("Page not found"))
}
async fn handle_404() -> impl IntoResponse { not_found_error(anyhow!("Page not found")) }
async fn handle_405() -> impl IntoResponse {
client_error(anyhow!("Method not allowed"))
}
async fn handle_405() -> impl IntoResponse { client_error(anyhow!("Method not allowed")) }

View file

@ -6,9 +6,7 @@ pub struct DeviceIdHeader(pub String);
pub static DEVICE_ID_HEADER_NAME: HeaderName = HeaderName::from_static("device-id");
impl Header for DeviceIdHeader {
fn name() -> &'static HeaderName {
&DEVICE_ID_HEADER_NAME
}
fn name() -> &'static HeaderName { &DEVICE_ID_HEADER_NAME }
fn decode<'i, I>(values: &mut I) -> Result<Self, headers::Error>
where

View file

@ -21,7 +21,7 @@ use crate::{
config::user_config::User,
errors::{SyncServerError, not_found_error, server_error},
utils::{
dedup_paths::dedup_paths, is_filetype_mergable::is_file_type_mergable,
dedup_paths::dedup_paths, is_file_type_mergable::is_file_type_mergable,
normalize::normalize, sanitize_path::sanitize_path,
},
};
@ -121,9 +121,9 @@ pub async fn update_document(
}
let merged_content = if is_file_type_mergable(&sanitized_relative_path)
&& is_binary(&parent_document.content)
&& is_binary(&latest_version.content)
&& is_binary(&content)
&& !is_binary(&parent_document.content)
&& !is_binary(&latest_version.content)
&& !is_binary(&content)
{
reconcile(
str::from_utf8(&parent_document.content)

View file

@ -1,4 +1,4 @@
pub mod dedup_paths;
pub mod is_filetype_mergable;
pub mod is_file_type_mergable;
pub mod normalize;
pub mod sanitize_path;

View file

@ -8,6 +8,4 @@ where
Ok(normalize_string(&s))
}
pub fn normalize_string(s: &str) -> String {
s.trim().to_lowercase()
}
pub fn normalize_string(s: &str) -> String { s.trim().to_lowercase() }