Skip to content

Commit

Permalink
Update toolchain and fix a bunch of warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
fogodev committed Sep 27, 2024
1 parent 7987071 commit fdff139
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 707 deletions.
16 changes: 0 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ sd-core-sync = { path = "./crates/sync" }
# Spacedrive Sub-crates
sd-actors = { path = "../crates/actors" }
sd-ai = { path = "../crates/ai", optional = true }
sd-cloud-api = { path = "../crates/cloud-api" }
sd-crypto = { path = "../crates/crypto" }
sd-ffmpeg = { path = "../crates/ffmpeg", optional = true }
sd-file-ext = { path = "../crates/file-ext" }
Expand Down
12 changes: 7 additions & 5 deletions core/crates/cloud-services/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use super::{
error::Error, key_manager::KeyManager, p2p::CloudP2P, token_refresher::TokenRefresher,
};

#[derive(Debug, Default)]
#[derive(Debug, Default, Clone)]
enum ClientState {
#[default]
NotConnected,
Expand Down Expand Up @@ -190,7 +190,8 @@ impl CloudServices {
_message: &[u8],
_cert: &rustls::pki_types::CertificateDer<'_>,
_dss: &rustls::DigitallySignedStruct,
) -> Result<rustls::client::danger::HandshakeSignatureValid, rustls::Error> {
) -> Result<rustls::client::danger::HandshakeSignatureValid, rustls::Error>
{
Ok(rustls::client::danger::HandshakeSignatureValid::assertion())
}

Expand All @@ -199,7 +200,8 @@ impl CloudServices {
_message: &[u8],
_cert: &rustls::pki_types::CertificateDer<'_>,
_dss: &rustls::DigitallySignedStruct,
) -> Result<rustls::client::danger::HandshakeSignatureValid, rustls::Error> {
) -> Result<rustls::client::danger::HandshakeSignatureValid, rustls::Error>
{
Ok(rustls::client::danger::HandshakeSignatureValid::assertion())
}

Expand Down Expand Up @@ -268,8 +270,8 @@ impl CloudServices {
/// Available routes documented in
/// [`sd_cloud_schema::Service`](https://github.com/spacedriveapp/cloud-services-schema).
pub async fn client(&self) -> Result<Client<QuinnConnection<Service>, Service>, Error> {
if let ClientState::Connected(client) = &*self.client_state.read().await {
return Ok(client.clone());
if let ClientState::Connected(client) = { self.client_state.read().await.clone() } {
return Ok(client);
}

// If we're not connected, we need to try to connect.
Expand Down
2 changes: 1 addition & 1 deletion core/crates/cloud-services/src/key_manager/key_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub struct KeyStore {
}

impl KeyStore {
pub fn new(iroh_secret_key: IrohSecretKey) -> Self {
pub const fn new(iroh_secret_key: IrohSecretKey) -> Self {
Self {
iroh_secret_key,
keys: BTreeMap::new(),
Expand Down
2 changes: 1 addition & 1 deletion core/crates/cloud-services/src/sync/ingest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ enum IngestStatus {
}

impl Ingester {
pub fn new(
pub const fn new(
sync: SyncManager,
ingest_notify: Arc<Notify>,
active: Arc<AtomicBool>,
Expand Down
2 changes: 1 addition & 1 deletion core/crates/heavy-lifting/src/job_system/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ impl ReportBuilder {
}

#[must_use]
pub fn new(id: JobId, name: JobName) -> Self {
pub const fn new(id: JobId, name: JobName) -> Self {
Self {
id,
name,
Expand Down
2 changes: 1 addition & 1 deletion core/src/library/statistics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub async fn update_library_statistics(
node.config
.data_directory()
.join("libraries")
.join(&format!("{}.db", library.id)),
.join(format!("{}.db", library.id)),
)
.await
.unwrap_or(0);
Expand Down
2 changes: 2 additions & 0 deletions core/src/location/manager/watcher/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ type Handler = ios::EventHandler;
pub(super) type IgnorePath = (PathBuf, bool);

type INode = u64;

#[cfg(any(target_os = "ios", target_os = "macos", target_os = "windows"))]
type InstantAndPath = (Instant, PathBuf);

const ONE_SECOND: Duration = Duration::from_secs(1);
Expand Down
6 changes: 4 additions & 2 deletions crates/actors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ impl<Id: ActorId> ActorsCollection<Id> {

#[instrument(skip(self))]
pub async fn start(&self, identifier: Id) {
if let Some(actor) = self.actors_map.write().await.get_mut(&identifier) {
let mut actors_map = self.actors_map.write().await;
if let Some(actor) = actors_map.get_mut(&identifier) {
if actor.is_running.load(Ordering::Acquire) {
warn!("Actor already running!");
return;
Expand Down Expand Up @@ -223,7 +224,8 @@ impl<Id: ActorId> ActorsCollection<Id> {

#[instrument(skip(self))]
pub async fn stop(&self, identifier: Id) {
if let Some(actor) = self.actors_map.write().await.get_mut(&identifier) {
let mut actors_map = self.actors_map.write().await;
if let Some(actor) = actors_map.get_mut(&identifier) {
if !actor.is_running.load(Ordering::Acquire) {
warn!("Actor already stopped!");
return;
Expand Down
21 changes: 0 additions & 21 deletions crates/cloud-api/Cargo.toml

This file was deleted.

17 changes: 0 additions & 17 deletions crates/cloud-api/src/auth.rs

This file was deleted.

Loading

0 comments on commit fdff139

Please sign in to comment.