Remove "no-std-compat" dependency (#24)
* Remove dependency on no-std-compat crate * Run tests with no_std (alloc) config on CI
This commit is contained in:
parent
1f3641c36b
commit
082e01153b
3 changed files with 22 additions and 15 deletions
8
.github/workflows/rust.yml
vendored
8
.github/workflows/rust.yml
vendored
|
@ -25,3 +25,11 @@ jobs:
|
||||||
run: cargo test --verbose
|
run: cargo test --verbose
|
||||||
- name: Run test release
|
- name: Run test release
|
||||||
run: cargo test --verbose --release
|
run: cargo test --verbose --release
|
||||||
|
test-alloc:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Run test
|
||||||
|
run: cargo test --verbose --no-default-features
|
||||||
|
- name: Run test release
|
||||||
|
run: cargo test --verbose --release --no-default-features
|
||||||
|
|
|
@ -22,13 +22,10 @@ status = "actively-developed"
|
||||||
criterion = "0.3.6"
|
criterion = "0.3.6"
|
||||||
rand="0.8.5"
|
rand="0.8.5"
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
no-std-compat = { version = "0.4.1", features = [ "alloc" ] }
|
|
||||||
|
|
||||||
[[bench]]
|
[[bench]]
|
||||||
name = "benches"
|
name = "benches"
|
||||||
harness = false
|
harness = false
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = [ "std" ] # Default to using the std
|
default = [ "std" ] # Default to using the std
|
||||||
std = [ "no-std-compat/std" ]
|
std = []
|
||||||
|
|
24
src/lib.rs
24
src/lib.rs
|
@ -33,18 +33,18 @@ assert_eq!(grid, grid![[1,2,3][4,5,6][7,8,9]])
|
||||||
|
|
||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
|
|
||||||
#[cfg(not(feature = "std"))]
|
#[cfg(all(not(feature = "std")))]
|
||||||
extern crate no_std_compat as std;
|
extern crate alloc;
|
||||||
#[cfg(not(feature = "std"))]
|
#[cfg(all(not(feature = "std")))]
|
||||||
use std::prelude::v1::*;
|
use alloc::{vec::Vec, vec, format};
|
||||||
|
|
||||||
use std::cmp::Eq;
|
use core::cmp::Eq;
|
||||||
use std::fmt;
|
use core::fmt;
|
||||||
use std::iter::StepBy;
|
use core::iter::StepBy;
|
||||||
use std::ops::Index;
|
use core::ops::Index;
|
||||||
use std::ops::IndexMut;
|
use core::ops::IndexMut;
|
||||||
use std::slice::Iter;
|
use core::slice::Iter;
|
||||||
use std::slice::IterMut;
|
use core::slice::IterMut;
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
|
@ -826,6 +826,8 @@ impl<T: Eq> Eq for Grid<T> {}
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
#[cfg(all(not(feature = "std")))]
|
||||||
|
use alloc::{string::String};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
|
|
Loading…
Reference in a new issue