diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index cb1d7e2..86b5480 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,6 +1,8 @@ name: Rust -on: [push] +on: + pull_request: + push: env: CARGO_TERM_COLOR: always @@ -111,3 +113,22 @@ jobs: with: command: build args: --target thumbv7em-none-eabihf --all-features + + build-without-alloc: + name: Build no-std without alloc + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Install stable no-std toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: thumbv7em-none-eabihf + override: true + + - name: Run cargo build + uses: actions-rs/cargo@v1 + with: + command: build + args: --target thumbv7em-none-eabihf --no-default-features diff --git a/src/with_alloc/alloc_ringbuffer.rs b/src/with_alloc/alloc_ringbuffer.rs index 7bf3252..b6fbd22 100644 --- a/src/with_alloc/alloc_ringbuffer.rs +++ b/src/with_alloc/alloc_ringbuffer.rs @@ -104,7 +104,7 @@ unsafe impl Send for AllocRingBuffer {} impl From<[T; N]> for AllocRingBuffer { fn from(value: [T; N]) -> Self { let mut rb = Self::with_capacity_non_power_of_two(value.len()); - rb.extend(value.into_iter()); + rb.extend(value); rb } } @@ -148,7 +148,7 @@ impl From<&mut [T; CAP]> for AllocRingBuffer From> for AllocRingBuffer { fn from(value: alloc::vec::Vec) -> Self { let mut res = AllocRingBuffer::with_capacity_non_power_of_two(value.len()); - res.extend(value.into_iter()); + res.extend(value); res } } @@ -156,7 +156,7 @@ impl From> for AllocRingBuffer { impl From> for AllocRingBuffer { fn from(value: alloc::collections::VecDeque) -> Self { let mut res = AllocRingBuffer::with_capacity_non_power_of_two(value.len()); - res.extend(value.into_iter()); + res.extend(value); res } } @@ -164,7 +164,7 @@ impl From> for AllocRingBuffer From> for AllocRingBuffer { fn from(value: alloc::collections::LinkedList) -> Self { let mut res = AllocRingBuffer::with_capacity_non_power_of_two(value.len()); - res.extend(value.into_iter()); + res.extend(value); res } } diff --git a/src/with_alloc/vecdeque.rs b/src/with_alloc/vecdeque.rs index 73e63d4..7b137ed 100644 --- a/src/with_alloc/vecdeque.rs +++ b/src/with_alloc/vecdeque.rs @@ -63,7 +63,7 @@ impl From<&mut [T; CAP]> for GrowableAllocRingBuffer impl From> for GrowableAllocRingBuffer { fn from(value: alloc::vec::Vec) -> Self { let mut res = GrowableAllocRingBuffer::new(); - res.extend(value.into_iter()); + res.extend(value); res } } @@ -71,7 +71,7 @@ impl From> for GrowableAllocRingBuffer { impl From> for GrowableAllocRingBuffer { fn from(value: alloc::collections::LinkedList) -> Self { let mut res = GrowableAllocRingBuffer::new(); - res.extend(value.into_iter()); + res.extend(value); res } } diff --git a/src/with_const_generics.rs b/src/with_const_generics.rs index 87a9baa..74d7013 100644 --- a/src/with_const_generics.rs +++ b/src/with_const_generics.rs @@ -1,11 +1,13 @@ use crate::ringbuffer_trait::{RingBufferIntoIterator, RingBufferIterator, RingBufferMutIterator}; -use crate::with_alloc::alloc_ringbuffer::RingbufferSize; use crate::RingBuffer; use core::iter::FromIterator; use core::mem; use core::mem::MaybeUninit; use core::ops::{Index, IndexMut}; +#[cfg(feature = "alloc")] +use crate::with_alloc::alloc_ringbuffer::RingbufferSize; + /// The `ConstGenericRingBuffer` struct is a `RingBuffer` implementation which does not require `alloc` but /// uses const generics instead. ///