diff --git a/capnp-rpc/src/rpc.rs b/capnp-rpc/src/rpc.rs index edcb5a601..628a7244e 100644 --- a/capnp-rpc/src/rpc.rs +++ b/capnp-rpc/src/rpc.rs @@ -38,7 +38,6 @@ use std::collections::binary_heap::BinaryHeap; use std::collections::hash_map::HashMap; use std::mem; use std::rc::{Rc, Weak}; -use std::vec::Vec; use crate::attach::Attach; use crate::local::ResultsDoneHook; diff --git a/capnp/src/any_pointer.rs b/capnp/src/any_pointer.rs index 7d10b048d..a08c1e1c0 100644 --- a/capnp/src/any_pointer.rs +++ b/capnp/src/any_pointer.rs @@ -21,9 +21,6 @@ //! Untyped pointer that can be cast to any struct, list, or capability type. -#[cfg(feature = "alloc")] -use alloc::{boxed::Box, vec::Vec}; - #[cfg(feature = "alloc")] use crate::capability::FromClientHook; #[cfg(feature = "alloc")] diff --git a/capnp/src/capability.rs b/capnp/src/capability.rs index 7cff20bbb..a2aabab36 100644 --- a/capnp/src/capability.rs +++ b/capnp/src/capability.rs @@ -23,12 +23,10 @@ //! //! Roughly corresponds to capability.h in the C++ implementation. -#[cfg(feature = "alloc")] -use alloc::boxed::Box; #[cfg(feature = "alloc")] use core::future::Future; #[cfg(feature = "alloc")] -use core::marker::{PhantomData, Unpin}; +use core::marker::PhantomData; #[cfg(feature = "rpc_try")] use core::ops::Try; #[cfg(feature = "alloc")] diff --git a/capnp/src/capability_list.rs b/capnp/src/capability_list.rs index a79831434..940499f58 100644 --- a/capnp/src/capability_list.rs +++ b/capnp/src/capability_list.rs @@ -21,7 +21,6 @@ //! List of capabilities. #![cfg(feature = "alloc")] -use alloc::boxed::Box; use core::marker::PhantomData; use crate::capability::FromClientHook; diff --git a/capnp/src/lib.rs b/capnp/src/lib.rs index 2185dad27..8a5e46fa1 100644 --- a/capnp/src/lib.rs +++ b/capnp/src/lib.rs @@ -64,11 +64,6 @@ pub mod text; pub mod text_list; pub mod traits; -#[cfg(feature = "alloc")] -use alloc::string::String; -#[cfg(feature = "alloc")] -use alloc::vec::Vec; - /// /// 8 bytes, aligned to an 8-byte boundary. /// diff --git a/capnp/src/message.rs b/capnp/src/message.rs index f48de73de..5a6d77b57 100644 --- a/capnp/src/message.rs +++ b/capnp/src/message.rs @@ -68,9 +68,6 @@ //! } //! //! ``` -#[cfg(feature = "alloc")] -use alloc::vec::Vec; -use core::convert::From; use crate::any_pointer; use crate::private::arena::{BuilderArena, BuilderArenaImpl}; diff --git a/capnp/src/private/arena.rs b/capnp/src/private/arena.rs index 065cb2f3d..a38340489 100644 --- a/capnp/src/private/arena.rs +++ b/capnp/src/private/arena.rs @@ -18,10 +18,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#[cfg(feature = "alloc")] -use alloc::vec::Vec; use core::slice; -use core::u64; use crate::message; use crate::message::Allocator; diff --git a/capnp/src/private/capability.rs b/capnp/src/private/capability.rs index ba725fb60..4b3a954cc 100644 --- a/capnp/src/private/capability.rs +++ b/capnp/src/private/capability.rs @@ -20,8 +20,6 @@ // THE SOFTWARE. #![cfg(feature = "alloc")] -use alloc::boxed::Box; -use alloc::vec::Vec; use crate::any_pointer; use crate::capability::{Params, Promise, RemotePromise, Request, Results}; diff --git a/capnp/src/private/layout.rs b/capnp/src/private/layout.rs index 79f815101..cf72b8b7b 100644 --- a/capnp/src/private/layout.rs +++ b/capnp/src/private/layout.rs @@ -19,8 +19,6 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#[cfg(feature = "alloc")] -use alloc::{boxed::Box, vec::Vec}; use core::cell::Cell; use core::mem; use core::ptr; @@ -345,8 +343,6 @@ impl WirePointer { } mod wire_helpers { - #[cfg(feature = "alloc")] - use alloc::boxed::Box; use core::{ptr, slice}; use crate::data; diff --git a/capnp/src/private/layout_test.rs b/capnp/src/private/layout_test.rs index 8715e9eda..b1291cc8b 100644 --- a/capnp/src/private/layout_test.rs +++ b/capnp/src/private/layout_test.rs @@ -28,7 +28,7 @@ fn test_at_alignments(words: &[crate::Word], verify: &dyn Fn(PointerReader)) { #[cfg(all(feature = "unaligned", feature = "alloc"))] { - let mut unaligned_data = crate::Vec::with_capacity((words.len() + 1) * 8); + let mut unaligned_data = Vec::with_capacity((words.len() + 1) * 8); for offset in 0..8 { unaligned_data.clear(); unaligned_data.resize(offset, 0); diff --git a/capnp/src/serialize.rs b/capnp/src/serialize.rs index 4550146c7..d7804564b 100644 --- a/capnp/src/serialize.rs +++ b/capnp/src/serialize.rs @@ -27,12 +27,6 @@ pub(crate) mod no_alloc_buffer_segments; pub use no_alloc_buffer_segments::{NoAllocBufferSegments, NoAllocSliceSegments}; use crate::io::{Read, Write}; -#[cfg(feature = "alloc")] -use alloc::vec::Vec; -#[cfg(feature = "alloc")] -use core::convert::TryInto; -#[cfg(feature = "alloc")] -use core::ops::Deref; use crate::message; use crate::private::units::BYTES_PER_WORD; @@ -113,7 +107,7 @@ pub struct BufferSegments { } #[cfg(feature = "alloc")] -impl> BufferSegments { +impl> BufferSegments { /// Reads a serialized message (including a segment table) from a buffer and takes ownership, without copying. /// The buffer is allowed to be longer than the message. Provide this to `Reader::new` with options that make /// sense for your use case. Very long lived mmaps may need unlimited traversal limit. @@ -143,7 +137,7 @@ impl> BufferSegments { } #[cfg(feature = "alloc")] -impl> message::ReaderSegments for BufferSegments { +impl> message::ReaderSegments for BufferSegments { fn get_segment(&self, id: u32) -> Option<&[u8]> { if id < self.segment_indices.len() as u32 { let (a, b) = self.segment_indices[id as usize]; @@ -686,8 +680,6 @@ where #[cfg(feature = "alloc")] #[cfg(test)] pub mod test { - use alloc::vec::Vec; - use crate::io::{Read, Write}; use quickcheck::{quickcheck, TestResult}; diff --git a/capnp/src/serialize/no_alloc_buffer_segments.rs b/capnp/src/serialize/no_alloc_buffer_segments.rs index 46db9961c..28aeedab5 100644 --- a/capnp/src/serialize/no_alloc_buffer_segments.rs +++ b/capnp/src/serialize/no_alloc_buffer_segments.rs @@ -1,5 +1,3 @@ -use core::convert::TryInto; - use crate::message::ReaderOptions; use crate::message::ReaderSegments; use crate::private::units::BYTES_PER_WORD; @@ -354,9 +352,6 @@ mod tests { #[cfg(feature = "alloc")] use super::{NoAllocBufferSegmentType, NoAllocBufferSegments, NoAllocSliceSegments}; - #[cfg(feature = "alloc")] - use alloc::vec::Vec; - #[repr(align(8))] struct Aligned([u8; 8]); diff --git a/capnp/src/serialize_packed.rs b/capnp/src/serialize_packed.rs index 86dba8700..4e49f6cff 100644 --- a/capnp/src/serialize_packed.rs +++ b/capnp/src/serialize_packed.rs @@ -452,8 +452,6 @@ where #[cfg(feature = "alloc")] #[cfg(test)] mod tests { - use alloc::vec::Vec; - use crate::io::{Read, Write}; use quickcheck::{quickcheck, TestResult}; diff --git a/capnpc/src/codegen.rs b/capnpc/src/codegen.rs index 7117940c8..8b98e72c7 100644 --- a/capnpc/src/codegen.rs +++ b/capnpc/src/codegen.rs @@ -23,7 +23,6 @@ use std::collections; use std::collections::{HashMap, HashSet}; use std::path::{Path, PathBuf}; -use capnp; use capnp::schema_capnp; use capnp::Error;