fix: resolve all clippy warnings and enforce cargo fmt
- display_helpers: convert module doc-comments to regular comments, merge identical text/markdown + text/ branches - search_service: replace needless range loops with slice-based pagination - folder_repository, folder_db_repository: collapse nested if statements - favorites_pg_repository: remove unnecessary borrow on generic arg - file_blob_read_repository: collapse 6 nested if-let blocks - file_blob_write_repository: collapse nested if for dedup ref decrement - chunked_upload_service: use div_ceil(), collapse 2 nested if blocks - folder_handler: collapse nested if-let for owner check - webdav_handler: replace 7x io::Error::new(ErrorKind::Other, ..) with io::Error::other(..) - cargo fmt applied to all files Passes: cargo clippy --all-targets --all-features -- -D warnings
This commit is contained in:
@@ -124,7 +124,13 @@ impl FileContentCache {
|
||||
/// Put file content into cache
|
||||
///
|
||||
/// Moka handles eviction automatically based on weight (content size).
|
||||
pub async fn put(&self, file_id: String, content: Bytes, etag: Arc<str>, content_type: Arc<str>) {
|
||||
pub async fn put(
|
||||
&self,
|
||||
file_id: String,
|
||||
content: Bytes,
|
||||
etag: Arc<str>,
|
||||
content_type: Arc<str>,
|
||||
) {
|
||||
let size = content.len();
|
||||
|
||||
// Don't cache if too large
|
||||
@@ -258,24 +264,14 @@ mod tests {
|
||||
// A file within the limit should be cached
|
||||
let small = Bytes::from(vec![0u8; 50]);
|
||||
cache
|
||||
.put(
|
||||
"small".to_string(),
|
||||
small,
|
||||
"e1".into(),
|
||||
"app/bin".into(),
|
||||
)
|
||||
.put("small".to_string(), small, "e1".into(), "app/bin".into())
|
||||
.await;
|
||||
assert!(cache.get("small").await.is_some());
|
||||
|
||||
// A file exceeding max_file_size is rejected by our own logic
|
||||
let big = Bytes::from(vec![1u8; 51]);
|
||||
cache
|
||||
.put(
|
||||
"big".to_string(),
|
||||
big,
|
||||
"e2".into(),
|
||||
"app/bin".into(),
|
||||
)
|
||||
.put("big".to_string(), big, "e2".into(), "app/bin".into())
|
||||
.await;
|
||||
assert!(
|
||||
cache.get("big").await.is_none(),
|
||||
@@ -296,12 +292,7 @@ mod tests {
|
||||
|
||||
let content = Bytes::from("test");
|
||||
cache
|
||||
.put(
|
||||
"file1".to_string(),
|
||||
content,
|
||||
"e".into(),
|
||||
"t".into(),
|
||||
)
|
||||
.put("file1".to_string(), content, "e".into(), "t".into())
|
||||
.await;
|
||||
|
||||
assert!(cache.get("file1").await.is_some());
|
||||
|
||||
Reference in New Issue
Block a user