@@ -360,25 +360,16 @@ where
360
360
/// println!("{}: \"{}\"", book, review);
361
361
/// }
362
362
/// ```
363
- pub struct IndexMap < K , V , S , const N : usize >
364
- where
365
- K : Eq + Hash ,
366
- {
363
+ pub struct IndexMap < K , V , S , const N : usize > {
367
364
core : CoreMap < K , V , N > ,
368
365
build_hasher : S ,
369
366
}
370
367
371
- impl < K , V , S , const N : usize > IndexMap < K , V , BuildHasherDefault < S > , N >
372
- where
373
- K : Eq + Hash ,
374
- S : Default + Hasher ,
375
- {
368
+ impl < K , V , S , const N : usize > IndexMap < K , V , BuildHasherDefault < S > , N > {
376
369
/// Creates an empty `IndexMap`.
377
- ///
378
- /// **NOTE** This constructor will become a `const fn` in the future
379
- pub fn new ( ) -> Self {
370
+ pub const fn new ( ) -> Self {
380
371
IndexMap {
381
- build_hasher : BuildHasherDefault :: default ( ) ,
372
+ build_hasher : BuildHasherDefault :: new ( ) ,
382
373
core : CoreMap :: new ( ) ,
383
374
}
384
375
}
@@ -737,7 +728,6 @@ where
737
728
K : Eq + Hash + Borrow < Q > ,
738
729
Q : ?Sized + Eq + Hash ,
739
730
S : BuildHasher ,
740
- // N: ArrayLength<Bucket<K, V>> + ArrayLength<Option<Pos>>,
741
731
{
742
732
type Output = V ;
743
733
@@ -751,7 +741,6 @@ where
751
741
K : Eq + Hash + Borrow < Q > ,
752
742
Q : ?Sized + Eq + Hash ,
753
743
S : BuildHasher ,
754
- // N: ArrayLength<Bucket<K, V>> + ArrayLength<Option<Pos>>,
755
744
{
756
745
fn index_mut ( & mut self , key : & Q ) -> & mut V {
757
746
self . get_mut ( key) . expect ( "key not found" )
@@ -763,7 +752,6 @@ where
763
752
K : Eq + Hash + Clone ,
764
753
V : Clone ,
765
754
S : Clone ,
766
- // N: ArrayLength<Bucket<K, V>> + ArrayLength<Option<Pos>>,
767
755
{
768
756
fn clone ( & self ) -> Self {
769
757
Self {
@@ -778,7 +766,6 @@ where
778
766
K : Eq + Hash + fmt:: Debug ,
779
767
V : fmt:: Debug ,
780
768
S : BuildHasher ,
781
- // N: ArrayLength<Bucket<K, V>> + ArrayLength<Option<Pos>>,
782
769
{
783
770
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
784
771
f. debug_map ( ) . entries ( self . iter ( ) ) . finish ( )
@@ -789,7 +776,6 @@ impl<K, V, S, const N: usize> Default for IndexMap<K, V, S, N>
789
776
where
790
777
K : Eq + Hash ,
791
778
S : BuildHasher + Default ,
792
- // N: ArrayLength<Bucket<K, V>> + ArrayLength<Option<Pos>>,
793
779
{
794
780
fn default ( ) -> Self {
795
781
IndexMap {
0 commit comments