@@ -56,7 +56,9 @@ impl Token {
56
56
}
57
57
58
58
fn from_node ( node : NodeIndex ) -> Token {
59
- Token { index : node. index ( ) as u32 }
59
+ Token {
60
+ index : node. index ( ) as u32 ,
61
+ }
60
62
}
61
63
62
64
fn node ( & self ) -> NodeIndex {
@@ -75,11 +77,12 @@ impl UnifyKey for Token {
75
77
fn tag ( ) -> & ' static str {
76
78
"CongruenceClosure"
77
79
}
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 ) > {
83
86
if a_value == b_value {
84
87
None
85
88
} else if a_value == Generative {
@@ -125,7 +128,8 @@ impl<K: Key> CongruenceClosure<K> {
125
128
/// keys) or else things will not work right. This invariant is
126
129
/// not currently checked.
127
130
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 ,
129
133
{
130
134
let token = self . table . new_key ( key_kind) ;
131
135
let key = key_op ( token) ;
@@ -194,10 +198,7 @@ impl<K: Key> CongruenceClosure<K> {
194
198
// example, if we are adding `Box<Foo>`, the successor would
195
199
// be `Foo`. So go ahead and recursively add `Foo` if it
196
200
// 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 ( ) ;
201
202
202
203
debug ! ( "add: key={:?} successors={:?}" , key, successors) ;
203
204
@@ -214,10 +215,12 @@ impl<K: Key> CongruenceClosure<K> {
214
215
// this would be `Box<Bar>` in the above example.
215
216
let predecessors: Vec < _ > = self . algorithm ( ) . all_preds ( successor) ;
216
217
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
+ ) ;
221
224
222
225
// add edge from new node `Box<Foo>` to its successor `Foo`
223
226
self . graph . add_edge ( token. node ( ) , successor. node ( ) , ( ) ) ;
@@ -246,8 +249,7 @@ impl<K: Key> CongruenceClosure<K> {
246
249
247
250
/// Gets the token for a key, if any.
248
251
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 ( ) )
251
253
}
252
254
253
255
/// 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> {
324
326
}
325
327
326
328
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
+ ) ;
330
334
331
335
if !self . unioned ( p_u, p_v) && self . shallow_eq ( p_u, p_v) && self . congruent ( p_u, p_v) {
332
336
self . merge ( p_u, p_v) ;
@@ -346,10 +350,12 @@ impl<'a, K: Key> Algorithm<'a, K> {
346
350
debug ! ( "congruent: s_u={:?} s_v={:?}" , s_u, s_v) ;
347
351
self . unioned ( s_u, s_v)
348
352
} ) ;
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
+ ) ;
353
359
r
354
360
}
355
361
@@ -371,10 +377,12 @@ impl<'a, K: Key> Algorithm<'a, K> {
371
377
372
378
fn unioned ( & mut self , u : Token , v : Token ) -> bool {
373
379
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
+ ) ;
378
386
r
379
387
}
380
388
@@ -404,9 +412,11 @@ impl<'a, K: Key> Algorithm<'a, K> {
404
412
} else {
405
413
// error: user asked us to union i32/u32 or Vec<T>/Vec<U>;
406
414
// 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
+ ) ;
410
420
}
411
421
}
412
422
}
0 commit comments