From 0022057058bd3c4bf448bf4248e4deb60abee79d Mon Sep 17 00:00:00 2001 From: kyren Date: Thu, 15 Jun 2017 10:26:39 -0400 Subject: rustfmt changes --- examples/examples.rs | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) (limited to 'examples') diff --git a/examples/examples.rs b/examples/examples.rs index 460a1ea..6bd7738 100644 --- a/examples/examples.rs +++ b/examples/examples.rs @@ -80,8 +80,9 @@ fn examples() -> LuaResult<()> { // Heterogeneous Lists. This is one way to call a function with multiple // parameters: - print - .call::<_, ()>(hlist!["hello", "again", "from", "rust"])?; + print.call::<_, ()>( + hlist!["hello", "again", "from", "rust"], + )?; // You can bind rust functions to lua as well @@ -106,16 +107,24 @@ fn examples() -> LuaResult<()> { // You can also accept variadic arguments to rust functions let join = lua.create_function(|lua, args| { - let strings = lua.unpack::>(args)?.0; - // (This is quadratic!, it's just an example!) - lua.pack(strings.iter().fold("".to_owned(), |a, b| a + b)) - })?; + let strings = lua.unpack::>(args)?.0; + // (This is quadratic!, it's just an example!) + lua.pack(strings.iter().fold("".to_owned(), |a, b| a + b)) + })?; globals.set("join", join)?; - assert_eq!(lua.eval::(r#"check_equal({"a", "b", "c"}, {"a", "b", "c"})"#)?, - true); - assert_eq!(lua.eval::(r#"check_equal({"a", "b", "c"}, {"d", "e", "f"})"#)?, - false); + assert_eq!( + lua.eval::( + r#"check_equal({"a", "b", "c"}, {"a", "b", "c"})"#, + )?, + true + ); + assert_eq!( + lua.eval::( + r#"check_equal({"a", "b", "c"}, {"d", "e", "f"})"#, + )?, + false + ); assert_eq!(lua.eval::(r#"join("a", "b", "c")"#)?, "abc"); // You can create userdata with methods and metamethods defined on them. @@ -145,8 +154,10 @@ fn examples() -> LuaResult<()> { })?; globals.set("vec2", vec2_constructor)?; - assert_eq!(lua.eval::("(vec2(1, 2) + vec2(2, 2)):magnitude()")?, - 5.0); + assert_eq!( + lua.eval::("(vec2(1, 2) + vec2(2, 2)):magnitude()")?, + 5.0 + ); Ok(()) } -- cgit v1.2.3