diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 9aa7efc..6d73779 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -27,10 +27,7 @@ on: description: "Choose which toolchain to test (stable, nightly, all)" required: true type: choice - options: - - stable - - nightly - - all + options: [stable, nightly, all] env: CARGO_TERM_COLOR: always @@ -45,12 +42,8 @@ jobs: target: [x86_64-unknown-linux-gnu] toolchain: [stable] steps: - - uses: actions/checkout@v6 - with: - fetch-depth: 0 - repository: ${{ github.repository }} - ref: ${{ github.ref }} - token: ${{ github.token }} + - name: Checkout + uses: actions/checkout@v6 - name: Setup Rust uses: actions-rust-lang/setup-rust-toolchain@v1 with: @@ -61,7 +54,7 @@ jobs: - name: Build the workspace run: cargo build -r --locked --workspace --features full --target ${{ matrix.target }} test: - if: (github.event_name == 'workflow_dispatch' && github.event.inputs.toolchain != 'nightly') || true + if: github.event_name != 'workflow_dispatch' || github.event.inputs.toolchain != 'nightly' needs: build runs-on: ubuntu-latest strategy: @@ -70,17 +63,15 @@ jobs: features: [full, default] target: [x86_64-unknown-linux-gnu] steps: - - uses: actions/checkout@v6 - with: - fetch-depth: 0 - repository: ${{ github.repository }} - ref: ${{ github.ref }} - token: ${{ github.token }} + - name: Checkout + uses: actions/checkout@v6 - name: Setup Rust uses: actions-rust-lang/setup-rust-toolchain@v1 with: cache-key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} target: ${{ matrix.target }} + toolchain: stable + override: true - name: Test (default) if: matrix.features == 'default' run: cargo test -r --locked --workspace --target ${{ matrix.target}} @@ -88,8 +79,7 @@ jobs: if: matrix.features != 'default' run: cargo test -r --locked --workspace --target ${{ matrix.target}} --features ${{ matrix.features }} test_nightly: - if: (github.event_name == 'workflow_dispatch' && github.event.inputs.toolchain != 'stable') || true - continue-on-error: true + if: github.event_name != 'workflow_dispatch' || github.event.inputs.toolchain != 'stable' needs: build runs-on: ubuntu-latest strategy: @@ -99,15 +89,9 @@ jobs: - all - no_std - "alloc,nightly" - package: - - rspace-traits steps: - - uses: actions/checkout@v6 - with: - fetch-depth: 0 - repository: ${{ github.repository }} - ref: ${{ github.ref }} - token: ${{ github.token }} + - name: Checkout + uses: actions/checkout@v6 - name: Setup Rust uses: actions-rust-lang/setup-rust-toolchain@v1 with: @@ -116,16 +100,16 @@ jobs: override: true - name: Test (all-features) if: matrix.features == 'all' - run: cargo test -r --locked --all-features --package ${{ matrix.package }} + run: cargo test -r --locked --all-features --workspace - name: Test (no_std) continue-on-error: true if: matrix.features == 'no_std' - run: cargo test -r --locked --no-default-features --package ${{ matrix.package }} + run: cargo test -r --locked --no-default-features --workspace env: RUSTFLAGS: "-C panic=abort -Z panic_abort_tests" - name: Test (${{ matrix.features }}) continue-on-error: true if: matrix.features != 'all' && matrix.features != 'no_std' - run: cargo test -r --locked --no-default-features --features ${{ matrix.features }} --package ${{ matrix.package }} + run: cargo test -r --locked --no-default-features --features ${{ matrix.features }} --workspace env: RUSTFLAGS: "-C panic=abort -Z panic_abort_tests" diff --git a/Cargo.lock b/Cargo.lock index 8f2cefa..65d6c53 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -769,7 +769,7 @@ checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" [[package]] name = "rspace" -version = "0.0.8" +version = "0.0.9" dependencies = [ "criterion", "rspace-core", @@ -780,7 +780,7 @@ dependencies = [ [[package]] name = "rspace-core" -version = "0.0.8" +version = "0.0.9" dependencies = [ "getrandom", "hashbrown 0.16.1", @@ -798,7 +798,7 @@ dependencies = [ [[package]] name = "rspace-traits" -version = "0.0.8" +version = "0.0.9" dependencies = [ "hashbrown 0.16.1", "ndarray", diff --git a/Cargo.toml b/Cargo.toml index 2daf505..45f2bb6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,12 +20,12 @@ license = "Apache-2.0" readme = "README.md" repository = "https://github.com/FL03/rspace.git" rust-version = "1.85.0" -version = "0.0.8" +version = "0.0.9" [workspace.dependencies] -rspace = { default-features = false, path = "rspace", version = "0.0.8" } -rspace-core = { default-features = false, path = "core", version = "0.0.8" } -rspace-traits = { default-features = false, path = "traits", version = "0.0.8" } +rspace = { default-features = false, path = "rspace", version = "0.0.9" } +rspace-core = { default-features = false, path = "core", version = "0.0.9" } +rspace-traits = { default-features = false, path = "traits", version = "0.0.9" } # development & benchmarking criterion = { version = "0.8" } # data structures diff --git a/Clippy.toml b/clippy.toml similarity index 100% rename from Clippy.toml rename to clippy.toml diff --git a/core/src/lib.rs b/core/src/lib.rs index 28c6d98..d16cb42 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -2,7 +2,7 @@ Appellation: core Contrib: FL03 */ -//! this core components of the contained crate +//! this modules defines the core pimitives and utilities for `rspace` #![allow( clippy::missing_safety_doc, clippy::module_inception, @@ -10,12 +10,7 @@ clippy::upper_case_acronyms )] #![cfg_attr(not(feature = "std"), no_std)] -#![cfg_attr(feature = "nightly", feature(allocator_api))] -// compiler checks -#[cfg(not(any(feature = "std", feature = "alloc")))] -compile_error! { - "Either the 'std' or 'alloc' feature must be enabled." -} +#![cfg_attr(all(feature = "alloc", feature = "nightly"), feature(allocator_api))] // external crates #[cfg(feature = "alloc")] extern crate alloc; diff --git a/default.nix b/default.nix index 5528100..e716a16 100644 --- a/default.nix +++ b/default.nix @@ -26,7 +26,7 @@ let }; common = { - version = "0.0.8"; + version = "0.0.9"; src = self; cargoLock = { diff --git a/flake.nix b/flake.nix index 454b6f1..5c43b26 100644 --- a/flake.nix +++ b/flake.nix @@ -19,7 +19,7 @@ in rec { packages.default = pkgs.rustPlatform.buildRustPackage { pname = "rspace"; - version = "0.0.8"; + version = "0.0.9"; src = self; # ./.; cargoLock = { lockFile = ./Cargo.lock; diff --git a/rspace/lib.rs b/rspace/lib.rs index 3bc43b9..27c72c7 100644 --- a/rspace/lib.rs +++ b/rspace/lib.rs @@ -14,11 +14,9 @@ clippy::upper_case_acronyms )] #![cfg_attr(not(feature = "std"), no_std)] -// compiler check -#[cfg(not(any(feature = "std", feature = "alloc")))] -compile_error! { "either the \"std\" or \"alloc\" feature must be enabled" } +#![cfg_attr(all(feature = "alloc", feature = "nightly"), feature(allocator_api))] // external crates -#[cfg(any(feature = "alloc", feature = "std"))] +#[cfg(feature = "alloc")] extern crate alloc; // declare external crates as modules #[doc(inline)] diff --git a/traits/src/impls/impl_map.rs b/traits/src/impls/impl_map.rs index 51810df..94c6241 100644 --- a/traits/src/impls/impl_map.rs +++ b/traits/src/impls/impl_map.rs @@ -83,29 +83,30 @@ mod impl_alloc { use alloc::alloc::Allocator; use alloc::vec::Vec; - impl MapInto for Vec + impl MapInto for Vec where A: Allocator, - F: FnMut(U) -> V, - Vec: FromIterator, + F: FnMut(X) -> Y, + Vec: FromIterator, { type Cont<_T> = Vec<_T, A>; - type Elem = U; + type Elem = X; - fn apply(self, f: F) -> Self::Cont { + fn apply(self, f: F) -> Self::Cont { self.into_iter().map(f).collect() } } - impl<'a, U, V, A, F> MapTo for &'a Vec + impl<'a, F, X, Y, A> MapTo for &'a Vec where A: Allocator, - F: FnMut(&U) -> V, + F: FnMut(&X) -> Y, + Vec: FromIterator, { type Cont<_T> = Vec<_T, A>; - type Elem = &'a U; + type Elem = &'a X; - fn apply(&self, f: F) -> Self::Cont { + fn apply(&self, f: F) -> Self::Cont { self.iter().map(f).collect() } } @@ -132,6 +133,7 @@ mod impl_alloc { impl<'a, U, V, F> MapTo for &'a Vec where F: FnMut(&U) -> V, + Vec: FromIterator, { type Cont<_T> = Vec<_T>; type Elem = &'a U;