Skip to content

Commit 3f3f9d9

Browse files
committed
apply the latest rustfmt
1 parent 18484c6 commit 3f3f9d9

File tree

6 files changed

+269
-129
lines changed

6 files changed

+269
-129
lines changed

src/cc/mod.rs

Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ impl Token {
5656
}
5757

5858
fn from_node(node: NodeIndex) -> Token {
59-
Token { index: node.index() as u32 }
59+
Token {
60+
index: node.index() as u32,
61+
}
6062
}
6163

6264
fn node(&self) -> NodeIndex {
@@ -75,11 +77,12 @@ impl UnifyKey for Token {
7577
fn tag() -> &'static str {
7678
"CongruenceClosure"
7779
}
78-
fn order_roots(a: Self,
79-
&a_value: &KeyKind,
80-
b: Self,
81-
&b_value: &KeyKind)
82-
-> Option<(Self, Self)> {
80+
fn order_roots(
81+
a: Self,
82+
&a_value: &KeyKind,
83+
b: Self,
84+
&b_value: &KeyKind,
85+
) -> Option<(Self, Self)> {
8386
if a_value == b_value {
8487
None
8588
} else if a_value == Generative {
@@ -125,7 +128,8 @@ impl<K: Key> CongruenceClosure<K> {
125128
/// keys) or else things will not work right. This invariant is
126129
/// not currently checked.
127130
pub fn new_token<OP>(&mut self, key_kind: KeyKind, key_op: OP) -> Token
128-
where OP: FnOnce(Token) -> K
131+
where
132+
OP: FnOnce(Token) -> K,
129133
{
130134
let token = self.table.new_key(key_kind);
131135
let key = key_op(token);
@@ -194,10 +198,7 @@ impl<K: Key> CongruenceClosure<K> {
194198
// example, if we are adding `Box<Foo>`, the successor would
195199
// be `Foo`. So go ahead and recursively add `Foo` if it
196200
// doesn't already exist.
197-
let successors: Vec<_> = key.successors()
198-
.into_iter()
199-
.map(|s| self.add(s))
200-
.collect();
201+
let successors: Vec<_> = key.successors().into_iter().map(|s| self.add(s)).collect();
201202

202203
debug!("add: key={:?} successors={:?}", key, successors);
203204

@@ -214,10 +215,12 @@ impl<K: Key> CongruenceClosure<K> {
214215
// this would be `Box<Bar>` in the above example.
215216
let predecessors: Vec<_> = self.algorithm().all_preds(successor);
216217

217-
debug!("add: key={:?} successor={:?} predecessors={:?}",
218-
key,
219-
successor,
220-
predecessors);
218+
debug!(
219+
"add: key={:?} successor={:?} predecessors={:?}",
220+
key,
221+
successor,
222+
predecessors
223+
);
221224

222225
// add edge from new node `Box<Foo>` to its successor `Foo`
223226
self.graph.add_edge(token.node(), successor.node(), ());
@@ -246,8 +249,7 @@ impl<K: Key> CongruenceClosure<K> {
246249

247250
/// Gets the token for a key, if any.
248251
fn get(&self, key: &K) -> Option<Token> {
249-
key.to_token()
250-
.or_else(|| self.map.get(key).cloned())
252+
key.to_token().or_else(|| self.map.get(key).cloned())
251253
}
252254

253255
/// Gets the token for a key, adding one if none exists. Returns the token
@@ -324,9 +326,11 @@ impl<'a, K: Key> Algorithm<'a, K> {
324326
}
325327

326328
fn maybe_merge(&mut self, p_u: Token, p_v: Token) {
327-
debug!("maybe_merge(): p_u={:?} p_v={:?}",
328-
self.key(p_u),
329-
self.key(p_v));
329+
debug!(
330+
"maybe_merge(): p_u={:?} p_v={:?}",
331+
self.key(p_u),
332+
self.key(p_v)
333+
);
330334

331335
if !self.unioned(p_u, p_v) && self.shallow_eq(p_u, p_v) && self.congruent(p_u, p_v) {
332336
self.merge(p_u, p_v);
@@ -346,10 +350,12 @@ impl<'a, K: Key> Algorithm<'a, K> {
346350
debug!("congruent: s_u={:?} s_v={:?}", s_u, s_v);
347351
self.unioned(s_u, s_v)
348352
});
349-
debug!("congruent({:?}, {:?}) = {:?}",
350-
self.key(p_u),
351-
self.key(p_v),
352-
r);
353+
debug!(
354+
"congruent({:?}, {:?}) = {:?}",
355+
self.key(p_u),
356+
self.key(p_v),
357+
r
358+
);
353359
r
354360
}
355361

@@ -371,10 +377,12 @@ impl<'a, K: Key> Algorithm<'a, K> {
371377

372378
fn unioned(&mut self, u: Token, v: Token) -> bool {
373379
let r = self.table.unioned(u, v);
374-
debug!("unioned(u={:?}, v={:?}) = {:?}",
375-
self.key(u),
376-
self.key(v),
377-
r);
380+
debug!(
381+
"unioned(u={:?}, v={:?}) = {:?}",
382+
self.key(u),
383+
self.key(v),
384+
r
385+
);
378386
r
379387
}
380388

@@ -404,9 +412,11 @@ impl<'a, K: Key> Algorithm<'a, K> {
404412
} else {
405413
// error: user asked us to union i32/u32 or Vec<T>/Vec<U>;
406414
// for now just panic.
407-
panic!("inconsistent conclusion: {:?} vs {:?}",
408-
self.key(u),
409-
self.key(v));
415+
panic!(
416+
"inconsistent conclusion: {:?} vs {:?}",
417+
self.key(u),
418+
self.key(v)
419+
);
410420
}
411421
}
412422
}

0 commit comments

Comments
 (0)