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
|
||||
- name: Run test 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"
|
||||
rand="0.8.5"
|
||||
|
||||
[dependencies]
|
||||
no-std-compat = { version = "0.4.1", features = [ "alloc" ] }
|
||||
|
||||
[[bench]]
|
||||
name = "benches"
|
||||
harness = false
|
||||
|
||||
[features]
|
||||
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(not(feature = "std"))]
|
||||
extern crate no_std_compat as std;
|
||||
#[cfg(not(feature = "std"))]
|
||||
use std::prelude::v1::*;
|
||||
#[cfg(all(not(feature = "std")))]
|
||||
extern crate alloc;
|
||||
#[cfg(all(not(feature = "std")))]
|
||||
use alloc::{vec::Vec, vec, format};
|
||||
|
||||
use std::cmp::Eq;
|
||||
use std::fmt;
|
||||
use std::iter::StepBy;
|
||||
use std::ops::Index;
|
||||
use std::ops::IndexMut;
|
||||
use std::slice::Iter;
|
||||
use std::slice::IterMut;
|
||||
use core::cmp::Eq;
|
||||
use core::fmt;
|
||||
use core::iter::StepBy;
|
||||
use core::ops::Index;
|
||||
use core::ops::IndexMut;
|
||||
use core::slice::Iter;
|
||||
use core::slice::IterMut;
|
||||
|
||||
#[doc(hidden)]
|
||||
#[macro_export]
|
||||
|
@ -826,6 +826,8 @@ impl<T: Eq> Eq for Grid<T> {}
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
#[cfg(all(not(feature = "std")))]
|
||||
use alloc::{string::String};
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
|
|
Loading…
Reference in a new issue