diff --git a/core/src/api/locations.rs b/core/src/api/locations.rs index 130077880..cd2bc58dd 100644 --- a/core/src/api/locations.rs +++ b/core/src/api/locations.rs @@ -23,7 +23,7 @@ use std::path::{Path, PathBuf}; use chrono::{DateTime, FixedOffset, Utc}; use directories::UserDirs; -use rspc::{self, alpha::AlphaRouter, ErrorCode}; +use rspc::{alpha::AlphaRouter, ErrorCode}; use serde::{Deserialize, Serialize}; use specta::Type; use tracing::{debug, error}; diff --git a/core/src/api/sync.rs b/core/src/api/sync.rs index 03360ed77..3cca88117 100644 --- a/core/src/api/sync.rs +++ b/core/src/api/sync.rs @@ -63,8 +63,7 @@ pub(crate) fn mount() -> AlphaRouter { MaybeUndefined::Undefined, Some(true), ) - .await - .unwrap(); + .await?; Ok(()) }) diff --git a/core/src/cloud/sync/ingest.rs b/core/src/cloud/sync/ingest.rs index 08f73e659..ef585a231 100644 --- a/core/src/cloud/sync/ingest.rs +++ b/core/src/cloud/sync/ingest.rs @@ -4,8 +4,8 @@ use tracing::info; use crate::cloud::sync::err_break; -//// Responsible for taking sync operations received from the cloud, -//// and applying them to the local database via the sync system's ingest actor. +// Responsible for taking sync operations received from the cloud, +// and applying them to the local database via the sync system's ingest actor. pub async fn run_actor(sync: Arc, notify: Arc) { loop { diff --git a/core/src/cloud/sync/receive.rs b/core/src/cloud/sync/receive.rs index 5d9ee574e..73492252b 100644 --- a/core/src/cloud/sync/receive.rs +++ b/core/src/cloud/sync/receive.rs @@ -21,8 +21,9 @@ use serde_json::to_vec; use tokio::{sync::Notify, time::sleep}; use uuid::Uuid; -//// Responsible for downloading sync operations from the cloud to be processed by the ingester +// Responsible for downloading sync operations from the cloud to be processed by the ingester +#[allow(clippy::too_many_arguments)] pub async fn run_actor( library: Arc, libraries: Arc, diff --git a/core/src/cloud/sync/send.rs b/core/src/cloud/sync/send.rs index c72904b92..4834f30b6 100644 --- a/core/src/cloud/sync/send.rs +++ b/core/src/cloud/sync/send.rs @@ -10,7 +10,7 @@ use tokio::time::sleep; use super::err_break; -//// Responsible for sending its instance's sync operations to the cloud. +// Responsible for sending its instance's sync operations to the cloud. pub async fn run_actor( library_id: Uuid, diff --git a/core/src/crypto/mod.rs b/core/src/crypto/mod.rs index 22cbf8346..7691eb0fc 100644 --- a/core/src/crypto/mod.rs +++ b/core/src/crypto/mod.rs @@ -21,7 +21,7 @@ // use sd_crypto::types::{DerivationContext, MagicBytes}; -pub mod error; +// pub mod error; // pub use error::{KeyManagerError, Result}; // pub mod keymanager; diff --git a/core/src/custom_uri/mod.rs b/core/src/custom_uri/mod.rs index 0c9567516..9c56fa02f 100644 --- a/core/src/custom_uri/mod.rs +++ b/core/src/custom_uri/mod.rs @@ -332,8 +332,7 @@ pub fn router(node: Arc) -> Router<()> { .parse() .expect("url was validated by Axum"); - let request_upgrade_header = - request.headers().get(header::UPGRADE).map(Clone::clone); + let request_upgrade_header = request.headers().get(header::UPGRADE).cloned(); let maybe_client_upgrade = request.extensions_mut().remove::(); let mut response = match operations::remote_rspc( diff --git a/core/src/custom_uri/mpsc_to_async_write.rs b/core/src/custom_uri/mpsc_to_async_write.rs index e05364577..90bd764c1 100644 --- a/core/src/custom_uri/mpsc_to_async_write.rs +++ b/core/src/custom_uri/mpsc_to_async_write.rs @@ -11,6 +11,7 @@ use tokio_util::sync::PollSender; pub struct MpscToAsyncWrite(PollSender>); impl MpscToAsyncWrite { + #[allow(dead_code)] pub fn new(sender: PollSender>) -> Self { Self(sender) } diff --git a/core/src/location/error.rs b/core/src/location/error.rs index 8f8b6c143..a0f5b1e20 100644 --- a/core/src/location/error.rs +++ b/core/src/location/error.rs @@ -7,7 +7,7 @@ use sd_utils::{ use std::path::Path; -use rspc::{self, ErrorCode}; +use rspc::ErrorCode; use thiserror::Error; use uuid::Uuid; diff --git a/core/src/location/indexer/old_walk.rs b/core/src/location/indexer/old_walk.rs index 3a27aa111..1b66ef96c 100644 --- a/core/src/location/indexer/old_walk.rs +++ b/core/src/location/indexer/old_walk.rs @@ -701,7 +701,6 @@ mod tests { use chrono::Utc; use globset::{Glob, GlobSetBuilder}; use tempfile::{tempdir, TempDir}; - use tokio::fs; // use tracing_test::traced_test; impl PartialEq for WalkedEntry { diff --git a/core/src/location/indexer/rules/mod.rs b/core/src/location/indexer/rules/mod.rs index 2343397f8..c86e8f533 100644 --- a/core/src/location/indexer/rules/mod.rs +++ b/core/src/location/indexer/rules/mod.rs @@ -15,7 +15,7 @@ use std::{ use chrono::{DateTime, Utc}; use futures::future::try_join_all; use globset::{Glob, GlobSet, GlobSetBuilder}; -use rmp_serde::{self, decode, encode}; +use rmp_serde::{decode, encode}; use rspc::ErrorCode; use serde::{de, ser, Deserialize, Serialize}; use specta::Type; @@ -622,7 +622,6 @@ pub fn generate_pub_id() -> Uuid { mod tests { use super::*; use tempfile::tempdir; - use tokio::fs; impl IndexerRule { pub fn new(name: String, default: bool, rules: Vec) -> Self { diff --git a/core/src/node/hardware.rs b/core/src/node/hardware.rs index 9e60aa18a..be0370e00 100644 --- a/core/src/node/hardware.rs +++ b/core/src/node/hardware.rs @@ -4,7 +4,6 @@ use std::str; use serde::{Deserialize, Serialize}; use specta::Type; use strum_macros::{Display, EnumIter}; -use sysinfo::SystemExt; #[repr(i32)] #[derive(Debug, Clone, Display, Copy, EnumIter, Type, Serialize, Deserialize, Eq, PartialEq)] diff --git a/core/src/object/fs/old_erase.rs b/core/src/object/fs/old_erase.rs index 45fa3823b..ba20637fe 100644 --- a/core/src/object/fs/old_erase.rs +++ b/core/src/object/fs/old_erase.rs @@ -22,7 +22,7 @@ use tokio::{ fs::{self, OpenOptions}, io::AsyncWriteExt, }; -use tracing::{trace, warn}; +use tracing::trace; use super::{ error::FileSystemJobsError, get_file_data_from_isolated_file_path, get_many_files_datas, @@ -147,11 +147,11 @@ impl StatefulJob for OldFileEraserJobInit { .open(&step.full_path) .await .map_err(|e| FileIOError::from((&step.full_path, e)))?; - let file_len = file - .metadata() - .await - .map_err(|e| FileIOError::from((&step.full_path, e)))? - .len(); + // let file_len = file + // .metadata() + // .await + // .map_err(|e| FileIOError::from((&step.full_path, e)))? + // .len(); trace!( "Overwriting file: {} with {} passes", diff --git a/core/src/object/media/old_thumbnail/process.rs b/core/src/object/media/old_thumbnail/process.rs index 38d857dd2..277f64700 100644 --- a/core/src/object/media/old_thumbnail/process.rs +++ b/core/src/object/media/old_thumbnail/process.rs @@ -17,7 +17,7 @@ use std::{ use async_channel as chan; use futures_concurrency::future::{Join, Race}; -use image::{self, imageops, DynamicImage, GenericImageView}; +use image::{imageops, DynamicImage, GenericImageView}; use serde::{Deserialize, Serialize}; use tokio::{ fs, io, diff --git a/core/src/object/old_orphan_remover.rs b/core/src/object/old_orphan_remover.rs index 9538c417e..35b316842 100644 --- a/core/src/object/old_orphan_remover.rs +++ b/core/src/object/old_orphan_remover.rs @@ -14,11 +14,13 @@ const ONE_MINUTE: Duration = Duration::from_secs(60); // Actor that can be invoked to find and delete objects with no matching file paths #[derive(Clone)] +#[allow(dead_code)] pub struct OrphanRemoverActor { tx: mpsc::Sender<()>, } impl OrphanRemoverActor { + #[allow(dead_code)] pub fn spawn(db: Arc) -> Self { let (tx, mut rx) = mpsc::channel(4); @@ -50,10 +52,12 @@ impl OrphanRemoverActor { Self { tx } } + #[allow(dead_code)] pub async fn invoke(&self) { self.tx.send(()).await.ok(); } + #[allow(dead_code)] async fn process_clean_up(db: &PrismaClient) { loop { let Ok(objects_ids) = db diff --git a/core/src/p2p/metadata.rs b/core/src/p2p/metadata.rs index 47d93dbd6..a54694158 100644 --- a/core/src/p2p/metadata.rs +++ b/core/src/p2p/metadata.rs @@ -1,6 +1,6 @@ use crate::node::{HardwareModel, Platform}; -use std::{collections::HashMap, env, str::FromStr}; +use std::{collections::HashMap, env, fmt::Display, str::FromStr}; use serde::{Deserialize, Serialize}; use specta::Type; @@ -89,20 +89,22 @@ impl OperatingSystem { } } -impl ToString for OperatingSystem { - fn to_string(&self) -> String { - match self { - OperatingSystem::Windows => "Windows".into(), - OperatingSystem::Linux => "Linux".into(), - OperatingSystem::MacOS => "MacOS".into(), - OperatingSystem::Ios => "IOS".into(), - OperatingSystem::Android => "Android".into(), +impl Display for OperatingSystem { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let s = match self { + OperatingSystem::Windows => "Windows", + OperatingSystem::Linux => "Linux", + OperatingSystem::MacOS => "MacOS", + OperatingSystem::Ios => "IOS", + OperatingSystem::Android => "Android", OperatingSystem::Other(s) => { let mut chars = s.chars(); chars.next(); - chars.as_str().to_string() + chars.as_str() } - } + }; + + f.write_str(s) } } diff --git a/core/src/preferences/library.rs b/core/src/preferences/library.rs index ca2d22cce..cb8963da8 100644 --- a/core/src/preferences/library.rs +++ b/core/src/preferences/library.rs @@ -2,12 +2,11 @@ use crate::api::search; use sd_prisma::prisma::PrismaClient; -use std::collections::{BTreeMap, HashMap}; +use std::collections::BTreeMap; use serde::{Deserialize, Serialize}; use specta::Type; use tracing::error; -use uuid::Uuid; use super::*; diff --git a/core/src/volume/mod.rs b/core/src/volume/mod.rs index 15bb387ff..fc0ffa306 100644 --- a/core/src/volume/mod.rs +++ b/core/src/volume/mod.rs @@ -8,16 +8,6 @@ use std::{ sync::OnceLock, }; -#[cfg(target_family = "unix")] -use std::os::unix::fs::MetadataExt; - -#[cfg(target_os = "ios")] -use icrate::{ - objc2::runtime::{Class, Object}, - objc2::{msg_send, sel}, - Foundation::{self, ns_string, NSFileManager, NSFileSystemSize, NSNumber, NSString}, -}; - use serde::{Deserialize, Serialize}; use serde_with::{serde_as, DisplayFromStr}; use specta::Type; diff --git a/crates/ai/src/old_image_labeler/process.rs b/crates/ai/src/old_image_labeler/process.rs index 92eda51ed..f5dfdcf17 100644 --- a/crates/ai/src/old_image_labeler/process.rs +++ b/crates/ai/src/old_image_labeler/process.rs @@ -1,3 +1,5 @@ +#![allow(non_camel_case_types)] + use sd_file_path_helper::{file_path_for_media_processor, IsolatedFilePathData}; use sd_prisma::{ prisma::{file_path, label, label_on_object, object, PrismaClient}, @@ -287,6 +289,7 @@ pub(super) async fn spawned_processing( .expect("critical error: image labeller batch processor unexpectedly closed"); } +#[allow(clippy::too_many_arguments)] async fn spawned_process_single_file( model_and_session: Arc>, (file_path_id, object_id): (file_path::id::Type, object::id::Type), diff --git a/crates/file-ext/src/magic.rs b/crates/file-ext/src/magic.rs index 008f19542..da858924b 100644 --- a/crates/file-ext/src/magic.rs +++ b/crates/file-ext/src/magic.rs @@ -177,13 +177,9 @@ impl Extension { path: impl AsRef, always_check_magic_bytes: bool, ) -> Option { - let Some(ext_str) = path.as_ref().extension().and_then(OsStr::to_str) else { - return None; - }; + let ext_str = path.as_ref().extension().and_then(OsStr::to_str)?; - let Some(ext) = Self::from_str(ext_str) else { - return None; - }; + let ext = Self::from_str(ext_str)?; let Ok(ref mut file) = File::open(&path).await else { return None; diff --git a/crates/images/src/pdf.rs b/crates/images/src/pdf.rs index 976520dd4..d74958cb7 100644 --- a/crates/images/src/pdf.rs +++ b/crates/images/src/pdf.rs @@ -1,5 +1,4 @@ use std::{ - borrow::ToOwned, env::current_exe, path::{Path, PathBuf}, }; diff --git a/crates/media-metadata/src/image/datetime.rs b/crates/media-metadata/src/image/datetime.rs index 15e1876a9..3840d4768 100644 --- a/crates/media-metadata/src/image/datetime.rs +++ b/crates/media-metadata/src/image/datetime.rs @@ -24,6 +24,7 @@ impl MediaDate { /// This iterates over all 3 pairs of time/offset tags in an attempt to create a UTC time. /// /// If the above fails, we fall back to Naive time - if that's not present this is `Undefined`. + #[must_use] pub fn from_reader(reader: &ExifReader) -> Option { let z = TIME_TAGS .into_iter() @@ -47,7 +48,7 @@ impl MediaDate { z.iter() .find(|x| matches!(x, Self::Utc(_) | Self::Naive(_))) - .map(Clone::clone) + .cloned() } /// Returns the amount of non-leap seconds since the Unix Epoch (1970-01-01T00:00:00+00:00) diff --git a/crates/p2p2/src/quic/transport.rs b/crates/p2p2/src/quic/transport.rs index eb8cf2efd..db82ce06e 100644 --- a/crates/p2p2/src/quic/transport.rs +++ b/crates/p2p2/src/quic/transport.rs @@ -38,6 +38,7 @@ const PROTOCOL: StreamProtocol = StreamProtocol::new("/sdp2p/1"); /// [libp2p::PeerId] for debugging purposes only. #[derive(Debug)] +#[allow(dead_code)] pub struct Libp2pPeerId(libp2p::PeerId); #[derive(Debug)] @@ -225,7 +226,7 @@ async fn start( tokio::select! { Ok(event) = rx.recv_async() => match event { HookEvent::PeerExpiredBy(_, identity) => { - let Some(peer) = p2p.peers.read().unwrap_or_else(PoisonError::into_inner).get(&identity).map(Clone::clone) else { + let Some(peer) = p2p.peers.read().unwrap_or_else(PoisonError::into_inner).get(&identity).cloned() else { continue; };