diff --git a/Cargo.toml b/Cargo.toml index bbd1eb5..1c0083e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,15 +1,16 @@ [package] name = "toolshed" -version = "0.7.0" +version = "0.8.0" authors = ["maciejhirsz "] license = "MIT/Apache-2.0" description = "Arena allocator and a handful of useful data structures" repository = "https://github.com/ratel-rust/toolshed" documentation = "https://docs.rs/toolshed/" readme = "README.md" +edition = "2018" [dependencies] -fxhash = "0.2" +rustc-hash = "1.0" serde = { version = "1.0", optional = true } [dev-dependencies] diff --git a/benches/bloomset.rs b/benches/bloomset.rs index 9f1dcb2..2fb5e81 100644 --- a/benches/bloomset.rs +++ b/benches/bloomset.rs @@ -1,13 +1,11 @@ #![feature(test)] extern crate test; -extern crate fxhash; -extern crate toolshed; use toolshed::set::{BloomSet, Set}; use toolshed::Arena; use test::{Bencher, black_box}; use std::collections::HashSet; -use fxhash::FxHashSet; +use rustc_hash::FxHashSet; static WORDS: &[&str] = &[ "ARENA_BLOCK", "Arena", "Cell", "Self", "String", "T", "Vec", "_unchecked", "a", diff --git a/benches/list.rs b/benches/list.rs index 3ace85a..53db5ad 100644 --- a/benches/list.rs +++ b/benches/list.rs @@ -1,7 +1,5 @@ #![feature(test)] extern crate test; -extern crate fxhash; -extern crate toolshed; use toolshed::list::ListBuilder; use toolshed::Arena; diff --git a/src/arena.rs b/src/arena.rs index 06a237a..e00b5a4 100644 --- a/src/arena.rs +++ b/src/arena.rs @@ -23,7 +23,7 @@ pub struct Arena { } /// A pointer to an uninitialized region of memory. -pub struct Uninitialized<'arena, T: Copy + 'arena> { +pub struct Uninitialized<'arena, T: Copy> { pointer: &'arena mut MaybeUninit, } @@ -33,7 +33,7 @@ union MaybeUninit { _uninit: (), } -impl<'arena, T: Copy + 'arena> Uninitialized<'arena, T> { +impl<'arena, T: Copy> Uninitialized<'arena, T> { /// Initialize the memory at the pointer with a given value. #[inline] pub fn init(self, value: T) -> &'arena mut T { @@ -69,7 +69,7 @@ impl<'arena, T: Copy + 'arena> Uninitialized<'arena, T> { } } -impl<'arena, T: Copy + 'arena> From<&'arena mut T> for Uninitialized<'arena, T> { +impl<'arena, T: Copy> From<&'arena mut T> for Uninitialized<'arena, T> { #[inline] fn from(pointer: &'arena mut T) -> Self { unsafe { Self::from_raw(pointer) } @@ -102,7 +102,6 @@ impl<'arena> NulTermStr<'arena> { /// would otherwise have to be length checks. /// /// ```rust - /// # extern crate toolshed; /// # use toolshed::Arena; /// # fn main() { /// let arena = Arena::new(); @@ -452,11 +451,9 @@ mod test { assert_eq!(arena.offset.get(), 16); assert_eq!( allocated, - &[ - b'a', b'b', b'c', b'd', b'e', b'f', b'g', b'h', b'i', b'j', b'k', 0 - ] + "abcdefghijk\u{0}".as_bytes(), ); - assert_eq!(nts.to_string(), "abcdefghijk"); + assert_eq!(&**nts, "abcdefghijk"); } } diff --git a/src/cell.rs b/src/cell.rs index aac5539..dca85f4 100644 --- a/src/cell.rs +++ b/src/cell.rs @@ -6,7 +6,7 @@ use std::marker::PhantomData; /// This should be identical to the `Cell` implementation in the standard /// library, but always require that the internal type implements `Copy` /// and implements `Copy` itself. -#[derive(PartialEq, Eq)] +#[derive(PartialEq, Eq, Copy, Clone)] #[repr(transparent)] pub struct CopyCell { /// Internal value @@ -23,8 +23,7 @@ unsafe impl Send for CopyCell {} impl CopyCell { /// Creates a new `CopyCell` containing the given value. - #[inline] - pub fn new(value: T) -> Self { + pub const fn new(value: T) -> Self { CopyCell { value, _no_sync: PhantomData @@ -39,19 +38,6 @@ impl CopyCell { self.value } - /// Returns a mutable reference to the underlying data. - /// - /// This call borrows `CopyCell` mutably, which gives us a compile time - /// memory safety guarantee. - #[inline] - pub fn get_mut<'a>(&'a mut self) -> &'a mut T { - // We can just cast the pointer from `CopyCell` to `T` because of - // #[repr(transparent)] - unsafe { - &mut *(self as *mut CopyCell as *mut T) - } - } - /// Sets the contained value. #[inline] pub fn set(&self, value: T) { @@ -71,19 +57,10 @@ impl CopyCell { } } -impl Clone for CopyCell { - #[inline] - fn clone(&self) -> CopyCell { - CopyCell::new(self.get()) - } -} - -impl Copy for CopyCell { } - -impl Debug for CopyCell { +impl Debug for CopyCell { #[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - Debug::fmt(&self.get(), f) + Debug::fmt(&self.value, f) } } @@ -94,8 +71,8 @@ mod test { #[test] fn cell() { let cell_a = CopyCell::new(42u64); - let mut cell_b = cell_a; // copy - let cell_c = &cell_a; // reference + let cell_b = cell_a; // copy + let cell_c = &cell_a; // reference assert_eq!(cell_a.get(), 42); assert_eq!(cell_b.get(), 42); @@ -116,7 +93,7 @@ mod test { assert_eq!(cell_c.get(), 200); // Again, only affects the copy - *cell_b.get_mut() = 300; + cell_b.set(300); assert_eq!(cell_a.get(), 200); assert_eq!(cell_b.get(), 300); diff --git a/src/impl_debug.rs b/src/impl_debug.rs index bcb6027..c04e1f4 100644 --- a/src/impl_debug.rs +++ b/src/impl_debug.rs @@ -1,7 +1,7 @@ use std::fmt::{self, Debug}; -use list::{List, GrowableList, ListBuilder}; -use map::{Map, BloomMap}; -use set::{Set, BloomSet}; +use crate::list::{List, GrowableList, ListBuilder}; +use crate::map::{Map, BloomMap}; +use crate::set::{Set, BloomSet}; impl<'arena, T> Debug for List<'arena, T> where @@ -78,7 +78,7 @@ where #[cfg(test)] mod test { use super::*; - use Arena; + use crate::Arena; #[test] fn list_debug() { diff --git a/src/impl_partial_eq.rs b/src/impl_partial_eq.rs index 8c202bf..0592592 100644 --- a/src/impl_partial_eq.rs +++ b/src/impl_partial_eq.rs @@ -1,6 +1,6 @@ -use list::List; -use map::{Map, BloomMap}; -use set::{Set, BloomSet}; +use crate::list::List; +use crate::map::{Map, BloomMap}; +use crate::set::{Set, BloomSet}; impl<'a, 'b, A, B> PartialEq> for List<'a, A> where diff --git a/src/impl_serialize.rs b/src/impl_serialize.rs index a9ae383..f1061ad 100644 --- a/src/impl_serialize.rs +++ b/src/impl_serialize.rs @@ -1,7 +1,7 @@ use serde::ser::{Serialize, Serializer}; -use list::List; -use map::{Map, BloomMap}; -use set::{Set, BloomSet}; +use crate::list::List; +use crate::map::{Map, BloomMap}; +use crate::set::{Set, BloomSet}; impl<'arena, T> Serialize for List<'arena, T> where @@ -74,7 +74,7 @@ where mod test { use super::*; use serde_json; - use Arena; + use crate::Arena; #[test] fn list_can_be_serialized() { diff --git a/src/lib.rs b/src/lib.rs index 6d40102..c5d1f04 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -32,9 +32,6 @@ //! ## Example //! //! ```rust -//! -//! extern crate toolshed; -//! //! use toolshed::Arena; //! use toolshed::map::Map; //! @@ -92,13 +89,11 @@ // Pull in serde if `impl_serialize` is enabled #[cfg(feature = "impl_serialize")] -extern crate serde; +use serde; // Pull in serde_json for testing if `impl_serialize` is enabled #[cfg(all(test, feature = "impl_serialize"))] -extern crate serde_json; - -extern crate fxhash; +use serde_json; mod cell; pub mod map; @@ -112,5 +107,5 @@ mod impl_debug; #[cfg(feature = "impl_serialize")] mod impl_serialize; -pub use arena::{Arena, Uninitialized, NulTermStr}; -pub use cell::CopyCell; +pub use self::arena::{Arena, Uninitialized, NulTermStr}; +pub use self::cell::CopyCell; diff --git a/src/list.rs b/src/list.rs index 7570455..e7844a4 100644 --- a/src/list.rs +++ b/src/list.rs @@ -1,28 +1,25 @@ //! A linked list and auxiliary types that can be used with the `Arena`. -use arena::Arena; -use cell::CopyCell; +use std::num::NonZeroUsize; -#[derive(Debug, PartialEq, Clone)] -struct ListNode<'arena, T: 'arena> { +use crate::arena::Arena; +use crate::cell::CopyCell; + +#[derive(Debug, PartialEq, Clone, Copy)] +struct ListNode<'arena, T> { value: T, next: CopyCell>>, } -impl<'arena, T: Copy> Copy for ListNode<'arena, T> {} - /// A single-ended linked list. -#[derive(Clone)] -pub struct List<'arena, T: 'arena> { +#[derive(Clone, Copy)] +pub struct List<'arena, T> { root: CopyCell>>, } -impl<'arena, T: Copy> Copy for List<'arena, T> { } - -impl<'arena, T: 'arena> List<'arena, T> { +impl<'arena, T> List<'arena, T> { /// Create a new empty `List`. - #[inline] - pub fn empty() -> Self { + pub const fn empty() -> Self { List { root: CopyCell::new(None) } @@ -76,15 +73,14 @@ impl<'arena, T: 'arena> List<'arena, T> { #[inline] pub fn into_unsafe(self) -> UnsafeList { UnsafeList { - root: match self.root.get() { - Some(ptr) => ptr as *const ListNode<'arena, T> as usize, - None => 0 - } + root: self.root.get().map(|ptr| unsafe { + NonZeroUsize::new_unchecked(ptr as *const ListNode as usize) + }), } } } -impl<'arena, T: 'arena + Copy> List<'arena, T> { +impl<'arena, T: Copy> List<'arena, T> { /// Create a single-element list from the given value. #[inline] pub fn from(arena: &'arena Arena, value: T) -> List<'arena, T> { @@ -132,10 +128,7 @@ impl<'arena, T: 'arena + Copy> List<'arena, T> { /// Removes the first element from the list and returns it. #[inline] pub fn shift(&self) -> Option<&'arena T> { - let list_item = match self.root.get() { - None => return None, - Some(list_item) => list_item - }; + let list_item = self.root.get()?; self.root.set(list_item.next.get()); @@ -150,10 +143,7 @@ impl<'arena, T: 'arena + Copy> List<'arena, T> { /// If you wish to modify the list use `shift` instead. #[inline] pub fn shift_ref(&mut self) -> Option<&'arena T> { - let list_item = match self.root.get() { - None => return None, - Some(list_item) => list_item - }; + let list_item = self.root.get()?; *self = List { root: list_item.next @@ -163,7 +153,7 @@ impl<'arena, T: 'arena + Copy> List<'arena, T> { } } -impl<'arena, T: 'arena> IntoIterator for List<'arena, T> { +impl<'arena, T> IntoIterator for List<'arena, T> { type Item = &'arena T; type IntoIter = ListIter<'arena, T>; @@ -173,7 +163,7 @@ impl<'arena, T: 'arena> IntoIterator for List<'arena, T> { } } -impl<'a, 'arena, T: 'arena> IntoIterator for &'a List<'arena, T> { +impl<'a, 'arena, T> IntoIterator for &'a List<'arena, T> { type Item = &'arena T; type IntoIter = ListIter<'arena, T>; @@ -186,17 +176,14 @@ impl<'a, 'arena, T: 'arena> IntoIterator for &'a List<'arena, T> { /// A variant of the `List` that keeps track of the last element and thus /// allows user to push to the end of the list. #[derive(Clone, Copy)] -pub struct GrowableList<'arena, T> -where - T: 'arena, -{ +pub struct GrowableList<'arena, T> { last: CopyCell>>, first: CopyCell>>, } impl<'arena, T> GrowableList<'arena, T> where - T: 'arena + Copy, + T: Copy, { /// Push a new item at the end of the `List`. #[inline] @@ -215,13 +202,9 @@ where } } -impl<'arena, T> GrowableList<'arena, T> -where - T: 'arena, -{ +impl<'arena, T> GrowableList<'arena, T> { /// Create a new builder. - #[inline] - pub fn new() -> Self { + pub const fn new() -> Self { GrowableList { first: CopyCell::new(None), last: CopyCell::new(None), @@ -243,18 +226,12 @@ where /// some checks on pushing given that it always has to have at least one /// element, and thus might be ever so slightly faster. #[derive(Clone, Copy)] -pub struct ListBuilder<'arena, T: 'arena> -where - T: 'arena, -{ +pub struct ListBuilder<'arena, T> { first: &'arena ListNode<'arena, T>, last: CopyCell<&'arena ListNode<'arena, T>>, } -impl<'arena, T> ListBuilder<'arena, T> -where - T: 'arena + Copy, -{ +impl<'arena, T: Copy> ListBuilder<'arena, T> { /// Create a new builder with the first element. #[inline] pub fn new(arena: &'arena Arena, first: T) -> Self { @@ -282,10 +259,7 @@ where } } -impl<'arena, T> ListBuilder<'arena, T> -where - T: 'arena, -{ +impl<'arena, T> ListBuilder<'arena, T> { /// Get a `List` from the builder. #[inline] pub fn as_list(&self) -> List<'arena, T> { @@ -298,29 +272,26 @@ where /// Unsafe variant of the `List` that erases any lifetime information. #[derive(Debug, Clone, Copy)] pub struct UnsafeList { - root: usize + root: Option, } impl UnsafeList { /// Converts the `UnsafeList` into a regular `List`. Using this with /// incorrect lifetimes of after the original arena has been dropped /// will lead to undefined behavior. Use with extreme care. - pub unsafe fn into_list<'arena, T: 'arena>(self) -> List<'arena, T> { + pub unsafe fn into_list<'arena, T>(self) -> List<'arena, T> { List { - root: CopyCell::new(match self.root { - 0 => None, - ptr => Some(&*(ptr as *const ListNode<'arena, T>)) - }) + root: CopyCell::new(self.root.map(|ptr| &*(ptr.get() as *const ListNode<'arena, T>))), } } } /// An iterator over the items in the list. -pub struct ListIter<'arena, T: 'arena> { +pub struct ListIter<'arena, T> { next: Option<&'arena ListNode<'arena, T>> } -impl<'arena, T: 'arena> Iterator for ListIter<'arena, T> { +impl<'arena, T> Iterator for ListIter<'arena, T> { type Item = &'arena T; #[inline] @@ -436,7 +407,7 @@ mod test { let list: List = List::empty(); let raw = list.into_unsafe(); - assert_eq!(raw.root, 0); + assert!(raw.root.is_none()); let list: List = unsafe { raw.into_list() }; @@ -454,7 +425,7 @@ mod test { let raw = list.into_unsafe(); - assert_ne!(raw.root, 0); + assert!(raw.root.is_some()); let list: List = unsafe { raw.into_list() }; diff --git a/src/map.rs b/src/map.rs index 32932b9..2e714f9 100644 --- a/src/map.rs +++ b/src/map.rs @@ -1,18 +1,14 @@ //! Maps of keys to values that can be used with the `Arena`. use std::hash::{Hash, Hasher}; -use fxhash::FxHasher; +use rustc_hash::FxHasher; -use cell::CopyCell; -use Arena; -use bloom::bloom; +use crate::cell::CopyCell; +use crate::Arena; +use crate::bloom::bloom; #[derive(Clone, Copy)] -struct MapNode<'arena, K, V> -where - K: 'arena, - V: 'arena + Copy, -{ +struct MapNode<'arena, K, V> { pub key: K, pub hash: u64, pub value: CopyCell, @@ -21,9 +17,8 @@ where pub next: CopyCell>>, } -impl<'arena, K, V: Copy> MapNode<'arena, K, V> { - #[inline] - pub fn new(key: K, hash: u64, value: V) -> Self { +impl<'arena, K, V> MapNode<'arena, K, V> { + pub const fn new(key: K, hash: u64, value: V) -> Self { MapNode { key, hash, @@ -41,39 +36,28 @@ impl<'arena, K, V: Copy> MapNode<'arena, K, V> { /// All the nodes of the map are also linked to allow iteration in /// insertion order. #[derive(Clone, Copy)] -pub struct Map<'arena, K, V> -where - K: 'arena, - V: 'arena + Copy, -{ +pub struct Map<'arena, K, V> { root: CopyCell>>, last: CopyCell>>, } -impl<'arena, K, V> Default for Map<'arena, K, V> -where - K: 'arena, - V: 'arena + Copy, -{ +impl<'arena, K, V> Default for Map<'arena, K, V> { fn default() -> Self { Self::new() } } -impl<'arena, K, V> Map<'arena, K, V> -where - K: 'arena, - V: 'arena + Copy, -{ +impl<'arena, K, V> Map<'arena, K, V> { /// Create a new, empty `Map`. - #[inline] - pub fn new() -> Self { + pub const fn new() -> Self { Map { root: CopyCell::new(None), last: CopyCell::new(None), } } +} +impl<'arena, K, V> Map<'arena, K, V> { /// Get an iterator over key value pairs. #[inline] pub fn iter(&self) -> MapIter<'arena, K, V> { @@ -97,8 +81,8 @@ where impl<'arena, K, V> Map<'arena, K, V> where - K: 'arena + Eq + Hash + Copy, - V: 'arena + Copy, + K: Eq + Hash + Copy, + V: Copy, { #[inline] fn hash_key(key: &K) -> u64 { @@ -188,25 +172,22 @@ where /// a common behavior. In this case it will very likely outperform a /// `HashMap`, even one with a fast hashing algorithm. #[derive(Clone, Copy)] -pub struct BloomMap<'arena, K: 'arena, V: 'arena + Copy> { +pub struct BloomMap<'arena, K, V> { filter: CopyCell, inner: Map<'arena, K, V>, } -impl<'arena, K, V> BloomMap<'arena, K, V> -where - K: 'arena, - V: 'arena + Copy, -{ +impl<'arena, K, V> BloomMap<'arena, K, V> { /// Create a new, empty `BloomMap`. - #[inline] - pub fn new() -> Self { + pub const fn new() -> Self { BloomMap { filter: CopyCell::new(0), inner: Map::new(), } } +} +impl<'arena, K, V: Copy> BloomMap<'arena, K, V> { /// Get an iterator over key value pairs. #[inline] pub fn iter(&self) -> MapIter<'arena, K, V> { @@ -227,11 +208,10 @@ where } } - impl<'arena, K, V> BloomMap<'arena, K, V> where - K: 'arena + Eq + Hash + Copy + AsRef<[u8]>, - V: 'arena + Copy, + K: Eq + Hash + Copy + AsRef<[u8]>, + V: Copy, { /// Inserts a key-value pair into the map. If the key was previously set, /// old value is returned. @@ -264,19 +244,11 @@ where /// An iterator over the entries in the map. /// All entries are returned in insertion order. -pub struct MapIter<'arena, K, V> -where - K: 'arena, - V: 'arena + Copy, -{ +pub struct MapIter<'arena, K, V> { next: Option<&'arena MapNode<'arena, K, V>> } -impl<'arena, K, V> Iterator for MapIter<'arena, K, V> -where - K: 'arena, - V: 'arena + Copy, -{ +impl<'arena, K, V: Copy> Iterator for MapIter<'arena, K, V> { type Item = (&'arena K, V); #[inline] @@ -284,19 +256,14 @@ where let next = self.next; next.map(|map_node| { - let key = &map_node.key; - let value = map_node.value.get(); + let item = (&map_node.key, map_node.value.get()); self.next = map_node.next.get(); - (key, value) + item }) } } -impl<'arena, K, V> IntoIterator for Map<'arena, K, V> -where - K: 'arena, - V: 'arena + Copy, -{ +impl<'arena, K, V: Copy> IntoIterator for Map<'arena, K, V> { type Item = (&'arena K, V); type IntoIter = MapIter<'arena, K, V>; @@ -306,11 +273,7 @@ where } } -impl<'arena, K, V> IntoIterator for BloomMap<'arena, K, V> -where - K: 'arena, - V: 'arena + Copy, -{ +impl<'arena, K, V: Copy> IntoIterator for BloomMap<'arena, K, V> { type Item = (&'arena K, V); type IntoIter = MapIter<'arena, K, V>; @@ -322,8 +285,8 @@ where impl<'arena, K, V> From> for BloomMap<'arena, K, V> where - K: 'arena + Eq + Hash + Copy + AsRef<[u8]>, - V: 'arena + Copy, + K: Eq + Hash + Copy + AsRef<[u8]>, + V: Copy, { fn from(map: Map<'arena, K, V>) -> BloomMap<'arena, K, V> { let mut filter = 0; @@ -339,11 +302,7 @@ where } } -impl<'arena, K, V> From> for Map<'arena, K, V> -where - K: 'arena + Eq + Hash + Copy + AsRef<[u8]>, - V: 'arena + Copy, -{ +impl<'arena, K, V> From> for Map<'arena, K, V> { #[inline] fn from(bloom_map: BloomMap<'arena, K, V>) -> Map<'arena, K, V> { bloom_map.inner diff --git a/src/set.rs b/src/set.rs index ad15c22..5f214b3 100644 --- a/src/set.rs +++ b/src/set.rs @@ -2,32 +2,25 @@ use std::hash::Hash; -use map::{Map, BloomMap, MapIter}; -use Arena; +use crate::map::{Map, BloomMap, MapIter}; +use crate::Arena; /// A set of values. This structure is using a `Map` with value /// type set to `()` internally. #[derive(Clone, Copy)] -pub struct Set<'arena, I: 'arena> { +pub struct Set<'arena, I> { map: Map<'arena, I, ()>, } -impl<'arena, I> Default for Set<'arena, I> -where - I: 'arena, -{ +impl Default for Set<'_, I> { fn default() -> Self { Self::new() } } -impl<'arena, I> Set<'arena, I> -where - I: 'arena, -{ +impl<'arena, I> Set<'arena, I> { /// Creates a new, empty `Set`. - #[inline] - pub fn new() -> Self { + pub const fn new() -> Self { Set { map: Map::new(), } @@ -56,7 +49,7 @@ where impl<'arena, I> Set<'arena, I> where - I: 'arena + Eq + Hash + Copy, + I: Eq + Hash + Copy, { /// Inserts a value into the set. #[inline] @@ -80,17 +73,13 @@ where /// A set of values with a bloom filter. This structure is /// using a `BloomMap` with value type set to `()` internally. #[derive(Clone, Copy)] -pub struct BloomSet<'arena, I: 'arena> { +pub struct BloomSet<'arena, I> { map: BloomMap<'arena, I, ()>, } -impl<'arena, I> BloomSet<'arena, I> -where - I: 'arena, -{ +impl<'arena, I> BloomSet<'arena, I> { /// Creates a new, empty `BloomSet`. - #[inline] - pub fn new() -> Self { + pub const fn new() -> Self { BloomSet { map: BloomMap::new(), } @@ -119,7 +108,7 @@ where impl<'arena, I> BloomSet<'arena, I> where - I: 'arena + Eq + Hash + Copy + AsRef<[u8]>, + I: Eq + Hash + Copy + AsRef<[u8]>, { /// Inserts a value into the set. #[inline] @@ -135,11 +124,11 @@ where } /// An iterator over the elements in the set. -pub struct SetIter<'arena, I: 'arena> { +pub struct SetIter<'arena, I> { inner: MapIter<'arena, I, ()> } -impl<'arena, I: 'arena> Iterator for SetIter<'arena, I> { +impl<'arena, I> Iterator for SetIter<'arena, I> { type Item = &'arena I; #[inline] @@ -148,10 +137,7 @@ impl<'arena, I: 'arena> Iterator for SetIter<'arena, I> { } } -impl<'arena, I> IntoIterator for Set<'arena, I> -where - I: 'arena, -{ +impl<'arena, I> IntoIterator for Set<'arena, I> { type Item = &'arena I; type IntoIter = SetIter<'arena, I>; @@ -161,10 +147,7 @@ where } } -impl<'arena, I> IntoIterator for BloomSet<'arena, I> -where - I: 'arena, -{ +impl<'arena, I> IntoIterator for BloomSet<'arena, I> { type Item = &'arena I; type IntoIter = SetIter<'arena, I>; @@ -176,7 +159,7 @@ where impl<'arena, I> From> for BloomSet<'arena, I> where - I: 'arena + Eq + Hash + Copy + AsRef<[u8]>, + I: Eq + Hash + Copy + AsRef<[u8]>, { #[inline] fn from(set: Set<'arena, I>) -> BloomSet<'arena, I> { @@ -186,10 +169,7 @@ where } } -impl<'arena, I> From> for Set<'arena, I> -where - I: 'arena + Eq + Hash + Copy + AsRef<[u8]>, -{ +impl<'arena, I> From> for Set<'arena, I> { #[inline] fn from(bloom_set: BloomSet<'arena, I>) -> Set<'arena, I> { Set {