提交 655ecd89 编写于 作者: G Guillaume Gomez 提交者: GitHub

Rollup merge of #37287 - srinivasreddy:unify, r=eddyb

run rustfmt on unify folder
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
/// ///
/// Clients are expected to provide implementations of this trait; you /// Clients are expected to provide implementations of this trait; you
/// can see some examples in the `test` module. /// can see some examples in the `test` module.
pub trait UnifyKey : Copy + Clone + Debug + PartialEq { pub trait UnifyKey: Copy + Clone + Debug + PartialEq {
type Value: Clone + PartialEq + Debug; type Value: Clone + PartialEq + Debug;
fn index(&self) -> u32; fn index(&self) -> u32;
...@@ -115,11 +115,7 @@ fn parent(&self, self_key: K) -> Option<K> { ...@@ -115,11 +115,7 @@ fn parent(&self, self_key: K) -> Option<K> {
} }
fn if_not_self(&self, key: K, self_key: K) -> Option<K> { fn if_not_self(&self, key: K, self_key: K) -> Option<K> {
if key == self_key { if key == self_key { None } else { Some(key) }
None
} else {
Some(key)
}
} }
} }
...@@ -236,7 +232,8 @@ fn redirect_root(&mut self, ...@@ -236,7 +232,8 @@ fn redirect_root(&mut self,
new_rank: u32, new_rank: u32,
old_root: VarValue<K>, old_root: VarValue<K>,
new_root: VarValue<K>, new_root: VarValue<K>,
new_value: K::Value) -> K { new_value: K::Value)
-> K {
let old_root_key = old_root.key(); let old_root_key = old_root.key();
let new_root_key = new_root.key(); let new_root_key = new_root.key();
self.set(old_root_key, old_root.redirect(new_root_key)); self.set(old_root_key, old_root.redirect(new_root_key));
...@@ -306,7 +303,8 @@ pub fn unify_var_var(&mut self, a_id: K, b_id: K) -> Result<K, (V, V)> { ...@@ -306,7 +303,8 @@ pub fn unify_var_var(&mut self, a_id: K, b_id: K) -> Result<K, (V, V)> {
let combined = { let combined = {
match (&node_a.value, &node_b.value) { match (&node_a.value, &node_b.value) {
(&None, &None) => None, (&None, &None) => None,
(&Some(ref v), &None) | (&None, &Some(ref v)) => Some(v.clone()), (&Some(ref v), &None) |
(&None, &Some(ref v)) => Some(v.clone()),
(&Some(ref v1), &Some(ref v2)) => { (&Some(ref v1), &Some(ref v2)) => {
if *v1 != *v2 { if *v1 != *v2 {
return Err((v1.clone(), v2.clone())); return Err((v1.clone(), v2.clone()));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册