Skip to content

Commit 4d7a3f6

Browse files
committed
Apply rustfmt
1 parent 04c964d commit 4d7a3f6

File tree

1 file changed

+48
-28
lines changed

1 file changed

+48
-28
lines changed

src/lib.rs

Lines changed: 48 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@
3939
//! # }
4040
//! ```
4141
42-
use std::collections::HashMap;
43-
use std::collections::hash_map::Iter;
44-
use std::hash::Hash;
4542
use std::borrow::Borrow;
43+
use std::collections::hash_map::Iter;
44+
use std::collections::HashMap;
4645
use std::fmt::{self, Debug};
46+
use std::hash::Hash;
4747

4848
#[derive(Eq)]
4949
pub struct MultiMap<K1: Eq + Hash, K2: Eq + Hash, V> {
@@ -137,8 +137,9 @@ impl<K1: Eq + Hash + Clone, K2: Eq + Hash + Clone, V> MultiMap<K1, K2, V> {
137137
/// given key is returned (if it exists), just like a HashMap. This removes
138138
/// an item from the main HashMap, and the second `<K2, K1>` HashMap.
139139
pub fn remove<Q: ?Sized>(&mut self, key: &Q) -> Option<V>
140-
where K1: Borrow<Q>,
141-
Q: Hash + Eq
140+
where
141+
K1: Borrow<Q>,
142+
Q: Hash + Eq,
142143
{
143144
let mut result = None;
144145
if let Some(pair) = self.value_map.remove(key) {
@@ -153,8 +154,9 @@ impl<K1: Eq + Hash + Clone, K2: Eq + Hash + Clone, V> MultiMap<K1, K2, V> {
153154
/// this. This removes an item from both the main HashMap and the second
154155
/// `<K2, K1>` HashMap.
155156
pub fn remove_alt<Q: ?Sized>(&mut self, key: &Q) -> Option<V>
156-
where K2: Borrow<Q>,
157-
Q: Hash + Eq
157+
where
158+
K2: Borrow<Q>,
159+
Q: Hash + Eq,
158160
{
159161
let mut result = None;
160162
if let Some(key_a) = self.key_map.remove(key) {
@@ -180,7 +182,13 @@ impl<K1: Eq + Hash, K2: Eq + Hash, V: Eq> PartialEq for MultiMap<K1, K2, V> {
180182

181183
impl<K1: Eq + Hash + Debug, K2: Eq + Hash + Debug, V: Debug> fmt::Debug for MultiMap<K1, K2, V> {
182184
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
183-
f.debug_map().entries(self.value_map.iter().map(|(key_one, &(ref key_two, ref value))| ((key_one, key_two), value))).finish()
185+
f.debug_map()
186+
.entries(
187+
self.value_map
188+
.iter()
189+
.map(|(key_one, &(ref key_two, ref value))| ((key_one, key_two), value)),
190+
)
191+
.finish()
184192
}
185193
}
186194

@@ -232,7 +240,7 @@ mod test {
232240

233241
#[test]
234242
fn big_test() {
235-
use ::MultiMap;
243+
use MultiMap;
236244

237245
let mut map = MultiMap::new();
238246

@@ -270,38 +278,50 @@ mod test {
270278

271279
#[test]
272280
fn macro_test() {
273-
use ::MultiMap;
281+
use MultiMap;
274282

275283
let map: MultiMap<i32, &str, String> = MultiMap::new();
276284

277-
assert_eq!(map, multimap!{});
285+
assert_eq!(map, multimap! {});
278286

279287
let mut map = MultiMap::new();
280288
map.insert(1, "One", String::from("Eins"));
281289

282-
assert_eq!(map, multimap!{
283-
1, "One" => String::from("Eins"),
284-
});
290+
assert_eq!(
291+
map,
292+
multimap! {
293+
1, "One" => String::from("Eins"),
294+
}
295+
);
285296

286-
assert_eq!(map, multimap!{
287-
1, "One" => String::from("Eins")
288-
});
297+
assert_eq!(
298+
map,
299+
multimap! {
300+
1, "One" => String::from("Eins")
301+
}
302+
);
289303

290304
let mut map = MultiMap::new();
291305
map.insert(1, "One", String::from("Eins"));
292306
map.insert(2, "Two", String::from("Zwei"));
293307
map.insert(3, "Three", String::from("Drei"));
294308

295-
assert_eq!(map, multimap!{
296-
1, "One" => String::from("Eins"),
297-
2, "Two" => String::from("Zwei"),
298-
3, "Three" => String::from("Drei"),
299-
});
300-
301-
assert_eq!(map, multimap!{
302-
1, "One" => String::from("Eins"),
303-
2, "Two" => String::from("Zwei"),
304-
3, "Three" => String::from("Drei")
305-
});
309+
assert_eq!(
310+
map,
311+
multimap! {
312+
1, "One" => String::from("Eins"),
313+
2, "Two" => String::from("Zwei"),
314+
3, "Three" => String::from("Drei"),
315+
}
316+
);
317+
318+
assert_eq!(
319+
map,
320+
multimap! {
321+
1, "One" => String::from("Eins"),
322+
2, "Two" => String::from("Zwei"),
323+
3, "Three" => String::from("Drei")
324+
}
325+
);
306326
}
307327
}

0 commit comments

Comments
 (0)