From f3ad0d75131adf0ea4ce846b38d774f5e74887e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Vasconcellos?= Date: Fri, 17 Nov 2023 19:47:06 -0300 Subject: [PATCH] Pin rust to 1.73 (Workaround Internal Compiler Error) (#1796) * Pin rust to 1.73 - Clippy fixes * Don't install cargo-watch on CI --- .github/actions/setup-rust/action.yaml | 2 +- CONTRIBUTING.md | 2 +- core/Cargo.toml | 2 +- core/src/api/search/object.rs | 4 ++-- core/src/api/search/saved.rs | 4 ++-- rust-toolchain.toml | 2 ++ scripts/setup.sh | 6 ++++-- 7 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 rust-toolchain.toml diff --git a/.github/actions/setup-rust/action.yaml b/.github/actions/setup-rust/action.yaml index 718060d49..04636be62 100644 --- a/.github/actions/setup-rust/action.yaml +++ b/.github/actions/setup-rust/action.yaml @@ -16,7 +16,7 @@ runs: uses: dtolnay/rust-toolchain@stable with: target: ${{ inputs.target }} - toolchain: stable + toolchain: '1.73' components: clippy, rustfmt - name: Cache Rust Dependencies diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c8f68accb..9e7624392 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -71,7 +71,7 @@ To run the landing page: If you encounter any issues, ensure that you are using the following versions of Rust, Node and Pnpm: -- Rust version: **1.70.0** +- Rust version: **1.73.0** - Node version: **18.17** - Pnpm version: **8.0.0** diff --git a/core/Cargo.toml b/core/Cargo.toml index aa37de849..7c497d664 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -3,7 +3,7 @@ name = "sd-core" version = "0.1.2" description = "Virtual distributed filesystem engine that powers Spacedrive." authors = ["Spacedrive Technology Inc."] -rust-version = "1.70.0" +rust-version = "1.73.0" license = { workspace = true } repository = { workspace = true } edition = { workspace = true } diff --git a/core/src/api/search/object.rs b/core/src/api/search/object.rs index 08c49a482..23ede56e0 100644 --- a/core/src/api/search/object.rs +++ b/core/src/api/search/object.rs @@ -136,8 +136,8 @@ impl ObjectFilterArgs { vec![ not![date_accessed::equals(None)], match v { - Range::From(v) => date_accessed::gte(v.into()), - Range::To(v) => date_accessed::lte(v.into()), + Range::From(v) => date_accessed::gte(v), + Range::To(v) => date_accessed::lte(v), }, ] } diff --git a/core/src/api/search/saved.rs b/core/src/api/search/saved.rs index f205e6e59..cafa55db2 100644 --- a/core/src/api/search/saved.rs +++ b/core/src/api/search/saved.rs @@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize}; use specta::Type; use uuid::Uuid; -use crate::{api::utils::library, invalidate_query, library::Library, prisma::saved_search}; +use crate::{api::utils::library, library::Library, prisma::saved_search}; use super::{Ctx, R}; @@ -111,7 +111,7 @@ pub(crate) fn mount() -> AlphaRouter { let result: Result, _> = searches .into_iter() .map(|search| { - let filters_bytes = search.filters.unwrap_or_else(Vec::new); + let filters_bytes = search.filters.unwrap_or_default(); let filters_string = String::from_utf8(filters_bytes).unwrap(); let filters: Vec = serde_json::from_str(&filters_string).unwrap(); diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 000000000..50fa4928b --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "1.73" diff --git a/scripts/setup.sh b/scripts/setup.sh index af29cdfd4..c42ddb65e 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -234,7 +234,9 @@ case "$(uname)" in ;; esac -echo "Installing Rust tools..." -cargo install cargo-watch +if [ "${CI:-}" != "true" ]; then + echo "Installing Rust tools..." + cargo install cargo-watch +fi echo 'Your machine has been setup for Spacedrive development!'