Skip to content

Commit 746f06e

Browse files
committed
cargo fmt
1 parent 90e4d3b commit 746f06e

File tree

4 files changed

+71
-27
lines changed

4 files changed

+71
-27
lines changed

src/external_trait_impls/rayon/map.rs

Lines changed: 45 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ pub struct ParIter<'a, K, V, S, A: AllocRef + Clone = Global> {
2020
map: &'a HashMap<K, V, S, A>,
2121
}
2222

23-
impl<'a, K: Sync, V: Sync, S: Sync, A: AllocRef + Clone + Sync> ParallelIterator for ParIter<'a, K, V, S, A> {
23+
impl<'a, K: Sync, V: Sync, S: Sync, A: AllocRef + Clone + Sync> ParallelIterator
24+
for ParIter<'a, K, V, S, A>
25+
{
2426
type Item = (&'a K, &'a V);
2527

2628
#[cfg_attr(feature = "inline-more", inline)]
@@ -46,7 +48,9 @@ impl<K, V, S, A: AllocRef + Clone> Clone for ParIter<'_, K, V, S, A> {
4648
}
4749
}
4850

49-
impl<K: fmt::Debug + Eq + Hash, V: fmt::Debug, S: BuildHasher, A: AllocRef + Clone> fmt::Debug for ParIter<'_, K, V, S, A> {
51+
impl<K: fmt::Debug + Eq + Hash, V: fmt::Debug, S: BuildHasher, A: AllocRef + Clone> fmt::Debug
52+
for ParIter<'_, K, V, S, A>
53+
{
5054
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
5155
self.map.iter().fmt(f)
5256
}
@@ -63,7 +67,9 @@ pub struct ParKeys<'a, K, V, S, A: AllocRef + Clone> {
6367
map: &'a HashMap<K, V, S, A>,
6468
}
6569

66-
impl<'a, K: Sync, V: Sync, S: Sync, A: AllocRef + Clone + Sync> ParallelIterator for ParKeys<'a, K, V, S, A> {
70+
impl<'a, K: Sync, V: Sync, S: Sync, A: AllocRef + Clone + Sync> ParallelIterator
71+
for ParKeys<'a, K, V, S, A>
72+
{
6773
type Item = &'a K;
6874

6975
#[cfg_attr(feature = "inline-more", inline)]
@@ -86,7 +92,9 @@ impl<K, V, S, A: AllocRef + Clone> Clone for ParKeys<'_, K, V, S, A> {
8692
}
8793
}
8894

89-
impl<K: fmt::Debug + Eq + Hash, V, S: BuildHasher, A: AllocRef + Clone> fmt::Debug for ParKeys<'_, K, V, S, A> {
95+
impl<K: fmt::Debug + Eq + Hash, V, S: BuildHasher, A: AllocRef + Clone> fmt::Debug
96+
for ParKeys<'_, K, V, S, A>
97+
{
9098
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
9199
self.map.keys().fmt(f)
92100
}
@@ -103,7 +111,9 @@ pub struct ParValues<'a, K, V, S, A: AllocRef + Clone = Global> {
103111
map: &'a HashMap<K, V, S, A>,
104112
}
105113

106-
impl<'a, K: Sync, V: Sync, S: Sync, A: AllocRef + Clone + Sync> ParallelIterator for ParValues<'a, K, V, S, A> {
114+
impl<'a, K: Sync, V: Sync, S: Sync, A: AllocRef + Clone + Sync> ParallelIterator
115+
for ParValues<'a, K, V, S, A>
116+
{
107117
type Item = &'a V;
108118

109119
#[cfg_attr(feature = "inline-more", inline)]
@@ -126,7 +136,9 @@ impl<K, V, S, A: AllocRef + Clone> Clone for ParValues<'_, K, V, S, A> {
126136
}
127137
}
128138

129-
impl<K: Eq + Hash, V: fmt::Debug, S: BuildHasher, A: AllocRef + Clone> fmt::Debug for ParValues<'_, K, V, S, A> {
139+
impl<K: Eq + Hash, V: fmt::Debug, S: BuildHasher, A: AllocRef + Clone> fmt::Debug
140+
for ParValues<'_, K, V, S, A>
141+
{
130142
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
131143
self.map.values().fmt(f)
132144
}
@@ -145,7 +157,9 @@ pub struct ParIterMut<'a, K, V, S, A: AllocRef + Clone> {
145157
map: &'a mut HashMap<K, V, S, A>,
146158
}
147159

148-
impl<'a, K: Send + Sync, V: Send, S: Send, A: AllocRef + Clone + Sync> ParallelIterator for ParIterMut<'a, K, V, S, A> {
160+
impl<'a, K: Send + Sync, V: Send, S: Send, A: AllocRef + Clone + Sync> ParallelIterator
161+
for ParIterMut<'a, K, V, S, A>
162+
{
149163
type Item = (&'a K, &'a mut V);
150164

151165
#[cfg_attr(feature = "inline-more", inline)]
@@ -183,7 +197,9 @@ pub struct ParValuesMut<'a, K, V, S, A: AllocRef + Clone = Global> {
183197
map: &'a mut HashMap<K, V, S, A>,
184198
}
185199

186-
impl<'a, K: Send, V: Send, S: Send, A: AllocRef + Clone + Send> ParallelIterator for ParValuesMut<'a, K, V, S, A> {
200+
impl<'a, K: Send, V: Send, S: Send, A: AllocRef + Clone + Send> ParallelIterator
201+
for ParValuesMut<'a, K, V, S, A>
202+
{
187203
type Item = &'a mut V;
188204

189205
#[cfg_attr(feature = "inline-more", inline)]
@@ -199,7 +215,9 @@ impl<'a, K: Send, V: Send, S: Send, A: AllocRef + Clone + Send> ParallelIterator
199215
}
200216
}
201217

202-
impl<K: Eq + Hash, V: fmt::Debug, S: BuildHasher, A: AllocRef + Clone> fmt::Debug for ParValuesMut<'_, K, V, S, A> {
218+
impl<K: Eq + Hash, V: fmt::Debug, S: BuildHasher, A: AllocRef + Clone> fmt::Debug
219+
for ParValuesMut<'_, K, V, S, A>
220+
{
203221
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
204222
self.map.values().fmt(f)
205223
}
@@ -218,7 +236,9 @@ pub struct IntoParIter<K, V, S, A: AllocRef + Clone = Global> {
218236
map: HashMap<K, V, S, A>,
219237
}
220238

221-
impl<K: Send, V: Send, S: Send, A: AllocRef + Clone + Send> ParallelIterator for IntoParIter<K, V, S, A> {
239+
impl<K: Send, V: Send, S: Send, A: AllocRef + Clone + Send> ParallelIterator
240+
for IntoParIter<K, V, S, A>
241+
{
222242
type Item = (K, V);
223243

224244
#[cfg_attr(feature = "inline-more", inline)]
@@ -230,7 +250,9 @@ impl<K: Send, V: Send, S: Send, A: AllocRef + Clone + Send> ParallelIterator for
230250
}
231251
}
232252

233-
impl<K: fmt::Debug + Eq + Hash, V: fmt::Debug, S: BuildHasher, A: AllocRef + Clone> fmt::Debug for IntoParIter<K, V, S, A> {
253+
impl<K: fmt::Debug + Eq + Hash, V: fmt::Debug, S: BuildHasher, A: AllocRef + Clone> fmt::Debug
254+
for IntoParIter<K, V, S, A>
255+
{
234256
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
235257
self.map.iter().fmt(f)
236258
}
@@ -247,7 +269,9 @@ pub struct ParDrain<'a, K, V, S, A: AllocRef + Clone = Global> {
247269
map: &'a mut HashMap<K, V, S, A>,
248270
}
249271

250-
impl<K: Send, V: Send, S: Send, A: AllocRef + Clone + Sync> ParallelIterator for ParDrain<'_, K, V, S, A> {
272+
impl<K: Send, V: Send, S: Send, A: AllocRef + Clone + Sync> ParallelIterator
273+
for ParDrain<'_, K, V, S, A>
274+
{
251275
type Item = (K, V);
252276

253277
#[cfg_attr(feature = "inline-more", inline)]
@@ -315,7 +339,9 @@ where
315339
}
316340
}
317341

318-
impl<K: Send, V: Send, S: Send, A: AllocRef + Clone + Send> IntoParallelIterator for HashMap<K, V, S, A> {
342+
impl<K: Send, V: Send, S: Send, A: AllocRef + Clone + Send> IntoParallelIterator
343+
for HashMap<K, V, S, A>
344+
{
319345
type Item = (K, V);
320346
type Iter = IntoParIter<K, V, S, A>;
321347

@@ -325,7 +351,9 @@ impl<K: Send, V: Send, S: Send, A: AllocRef + Clone + Send> IntoParallelIterator
325351
}
326352
}
327353

328-
impl<'a, K: Sync, V: Sync, S: Sync, A: AllocRef + Clone + Sync> IntoParallelIterator for &'a HashMap<K, V, S, A> {
354+
impl<'a, K: Sync, V: Sync, S: Sync, A: AllocRef + Clone + Sync> IntoParallelIterator
355+
for &'a HashMap<K, V, S, A>
356+
{
329357
type Item = (&'a K, &'a V);
330358
type Iter = ParIter<'a, K, V, S, A>;
331359

@@ -335,7 +363,9 @@ impl<'a, K: Sync, V: Sync, S: Sync, A: AllocRef + Clone + Sync> IntoParallelIter
335363
}
336364
}
337365

338-
impl<'a, K: Send + Sync, V: Send, S: Send, A: AllocRef + Clone + Sync> IntoParallelIterator for &'a mut HashMap<K, V, S, A> {
366+
impl<'a, K: Send + Sync, V: Send, S: Send, A: AllocRef + Clone + Sync> IntoParallelIterator
367+
for &'a mut HashMap<K, V, S, A>
368+
{
339369
type Item = (&'a K, &'a mut V);
340370
type Iter = ParIterMut<'a, K, V, S, A>;
341371

src/external_trait_impls/rayon/set.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ pub struct ParDrain<'a, T, S, A: AllocRef + Clone = Global> {
4545
set: &'a mut HashSet<T, S, A>,
4646
}
4747

48-
impl<T: Send, S: Send, A: AllocRef + Clone + Send + Sync> ParallelIterator for ParDrain<'_, T, S, A> {
48+
impl<T: Send, S: Send, A: AllocRef + Clone + Send + Sync> ParallelIterator
49+
for ParDrain<'_, T, S, A>
50+
{
4951
type Item = T;
5052

5153
fn drive_unindexed<C>(self, consumer: C) -> C::Result
@@ -216,14 +218,12 @@ where
216218
T: Eq + Hash + Sync,
217219
S: BuildHasher + Sync,
218220
{
219-
220221
/// Visits (potentially in parallel) the values representing the union,
221222
/// i.e. all the values in `self` or `other`, without duplicates.
222223
#[cfg_attr(feature = "inline-more", inline)]
223224
pub fn par_union<'a>(&'a self, other: &'a Self) -> ParUnion<'a, T, S> {
224225
ParUnion { a: self, b: other }
225226
}
226-
227227
}
228228

229229
impl<T, S, A> HashSet<T, S, A>
@@ -317,7 +317,9 @@ impl<T: Send, S: Send, A: AllocRef + Clone + Send> IntoParallelIterator for Hash
317317
}
318318
}
319319

320-
impl<'a, T: Sync, S: Sync, A: AllocRef + Clone + Sync> IntoParallelIterator for &'a HashSet<T, S, A> {
320+
impl<'a, T: Sync, S: Sync, A: AllocRef + Clone + Sync> IntoParallelIterator
321+
for &'a HashSet<T, S, A>
322+
{
321323
type Item = &'a T;
322324
type Iter = ParIter<'a, T, S, A>;
323325

src/map.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::raw::{Bucket, AllocRef, Global, RawDrain, RawIntoIter, RawIter, RawTable};
1+
use crate::raw::{AllocRef, Bucket, Global, RawDrain, RawIntoIter, RawIter, RawTable};
22
use crate::CollectionAllocErr;
33
use core::borrow::Borrow;
44
use core::fmt::{self, Debug};
@@ -1932,7 +1932,10 @@ impl<K, V, S, A: AllocRef + Clone> Debug for RawEntryBuilder<'_, K, V, S, A> {
19321932
///
19331933
/// [`HashMap`]: struct.HashMap.html
19341934
/// [`entry`]: struct.HashMap.html#method.entry
1935-
pub enum Entry<'a, K, V, S, A> where A: AllocRef + Clone {
1935+
pub enum Entry<'a, K, V, S, A>
1936+
where
1937+
A: AllocRef + Clone,
1938+
{
19361939
/// An occupied entry.
19371940
Occupied(OccupiedEntry<'a, K, V, S, A>),
19381941

@@ -2721,7 +2724,8 @@ where
27212724
#[cfg_attr(feature = "inline-more", inline)]
27222725
fn from_iter<T: IntoIterator<Item = (K, V)>>(iter: T) -> Self {
27232726
let iter = iter.into_iter();
2724-
let mut map = Self::with_capacity_and_hasher_in(iter.size_hint().0, S::default(), A::default());
2727+
let mut map =
2728+
Self::with_capacity_and_hasher_in(iter.size_hint().0, S::default(), A::default());
27252729
iter.for_each(|(k, v)| {
27262730
map.insert(k, v);
27272731
});
@@ -2781,10 +2785,14 @@ fn assert_covariance() {
27812785
fn iter_val<'a, 'new>(v: Iter<'a, u8, &'static str>) -> Iter<'a, u8, &'new str> {
27822786
v
27832787
}
2784-
fn into_iter_key<'new, A: AllocRef + Clone>(v: IntoIter<&'static str, u8, A>) -> IntoIter<&'new str, u8, A> {
2788+
fn into_iter_key<'new, A: AllocRef + Clone>(
2789+
v: IntoIter<&'static str, u8, A>,
2790+
) -> IntoIter<&'new str, u8, A> {
27852791
v
27862792
}
2787-
fn into_iter_val<'new, A: AllocRef + Clone>(v: IntoIter<u8, &'static str, A>) -> IntoIter<u8, &'new str, A> {
2793+
fn into_iter_val<'new, A: AllocRef + Clone>(
2794+
v: IntoIter<u8, &'static str, A>,
2795+
) -> IntoIter<u8, &'new str, A> {
27882796
v
27892797
}
27902798
fn keys_key<'a, 'new>(v: Keys<'a, &'static str, u8>) -> Keys<'a, &'new str, u8> {

src/set.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use core::hash::{BuildHasher, Hash};
55
use core::iter::{Chain, FromIterator, FusedIterator};
66
use core::ops::{BitAnd, BitOr, BitXor, Sub};
77

8-
use crate::raw::{AllocRef, Global};
98
use super::map::{self, DefaultHashBuilder, HashMap, Keys};
9+
use crate::raw::{AllocRef, Global};
1010

1111
// Future Optimization (FIXME!)
1212
// =============================
@@ -1606,7 +1606,9 @@ fn assert_covariance() {
16061606
fn iter<'a, 'new>(v: Iter<'a, &'static str>) -> Iter<'a, &'new str> {
16071607
v
16081608
}
1609-
fn into_iter<'new, A: AllocRef + Clone>(v: IntoIter<&'static str, A>) -> IntoIter<&'new str, A> {
1609+
fn into_iter<'new, A: AllocRef + Clone>(
1610+
v: IntoIter<&'static str, A>,
1611+
) -> IntoIter<&'new str, A> {
16101612
v
16111613
}
16121614
fn difference<'a, 'new, A: AllocRef + Clone>(
@@ -1629,7 +1631,9 @@ fn assert_covariance() {
16291631
) -> Union<'a, &'new str, DefaultHashBuilder, A> {
16301632
v
16311633
}
1632-
fn drain<'new, A: AllocRef + Clone>(d: Drain<'static, &'static str, A>) -> Drain<'new, &'new str, A> {
1634+
fn drain<'new, A: AllocRef + Clone>(
1635+
d: Drain<'static, &'static str, A>,
1636+
) -> Drain<'new, &'new str, A> {
16331637
d
16341638
}
16351639
}

0 commit comments

Comments
 (0)