From 0200ea145868eccd2686359991e918ecc4dd1cde Mon Sep 17 00:00:00 2001 From: pca006132 Date: Mon, 28 Dec 2020 16:00:02 +0800 Subject: [PATCH] formatting --- nac3type/src/inference.rs | 69 +++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/nac3type/src/inference.rs b/nac3type/src/inference.rs index 0cd2270070..87d4da8875 100644 --- a/nac3type/src/inference.rs +++ b/nac3type/src/inference.rs @@ -233,13 +233,7 @@ mod tests { ); assert_eq!( - resolve_call( - &ctx, - None, - "float", - create_tuple(vec![]), - &mut assumptions - ), + resolve_call(&ctx, None, "float", create_tuple(vec![]), &mut assumptions), Err("different parametric types".to_string()) ); @@ -493,14 +487,20 @@ mod tests { let list = ctx.get_parametric_mut(LIST_TYPE); let t = Rc::new(TypeVariable(list.params[0])); - list.base.methods.insert("head", FnDef { - args: create_tuple(vec![]), - result: Some(t.clone()) - }); - list.base.methods.insert("append", FnDef { - args: create_tuple(vec![t.clone()]), - result: None - }); + list.base.methods.insert( + "head", + FnDef { + args: create_tuple(vec![]), + result: Some(t.clone()), + }, + ); + list.base.methods.insert( + "append", + FnDef { + args: create_tuple(vec![t.clone()]), + result: None, + }, + ); let v0 = Rc::new(TypeVariable(ctx.add_variable(VarDef { name: "V0", @@ -541,7 +541,6 @@ mod tests { ), Err("different variables".to_string()) ); - } #[test] @@ -553,46 +552,52 @@ mod tests { base: TypeDef { name: "Foo", methods: HashMap::new(), - fields: HashMap::new() + fields: HashMap::new(), }, - parents: vec![] + parents: vec![], }); let foo1 = ctx.add_class(ClassDef { base: TypeDef { name: "Foo1", methods: HashMap::new(), - fields: HashMap::new() + fields: HashMap::new(), }, - parents: vec![foo] + parents: vec![foo], }); let foo2 = ctx.add_class(ClassDef { base: TypeDef { name: "Foo2", methods: HashMap::new(), - fields: HashMap::new() + fields: HashMap::new(), }, - parents: vec![foo1] + parents: vec![foo1], }); let bar = ctx.add_class(ClassDef { base: TypeDef { name: "bar", methods: HashMap::new(), - fields: HashMap::new() + fields: HashMap::new(), }, - parents: vec![] + parents: vec![], }); - ctx.add_fn("foo", FnDef { - args: create_tuple(vec![VirtualClassType(foo).into()]), - result: None - }); - ctx.add_fn("foo1", FnDef { - args: create_tuple(vec![VirtualClassType(foo1).into()]), - result: None - }); + ctx.add_fn( + "foo", + FnDef { + args: create_tuple(vec![VirtualClassType(foo).into()]), + result: None, + }, + ); + ctx.add_fn( + "foo1", + FnDef { + args: create_tuple(vec![VirtualClassType(foo1).into()]), + result: None, + }, + ); assert_eq!( resolve_call(