diff --git a/benches/benchmark.rs b/benches/benchmark.rs index a6cb852..de1734c 100644 --- a/benches/benchmark.rs +++ b/benches/benchmark.rs @@ -58,8 +58,8 @@ fn call_add_function(c: &mut Criterion) { || { let lua = Lua::new(); let f = { - let f: LuaFunction = - lua.eval( + let f: LuaFunction = lua + .eval( r#" function(a, b, c) return a + b + c @@ -94,8 +94,8 @@ fn call_add_callback(c: &mut Criterion) { .create_function(|_, (a, b, c): (i64, i64, i64)| Ok(a + b + c)) .unwrap(); lua.globals().set("callback", c).unwrap(); - let f: LuaFunction = - lua.eval( + let f: LuaFunction = lua + .eval( r#" function() for i = 1,10 do @@ -126,13 +126,13 @@ fn call_append_callback(c: &mut Criterion) { || { let lua = Lua::new(); let f = { - let c: LuaFunction = - lua.create_function(|_, (a, b): (LuaString, LuaString)| { + let c: LuaFunction = lua + .create_function(|_, (a, b): (LuaString, LuaString)| { Ok(format!("{}{}", a.to_str()?, b.to_str()?)) }).unwrap(); lua.globals().set("callback", c).unwrap(); - let f: LuaFunction = - lua.eval( + let f: LuaFunction = lua + .eval( r#" function() for _ = 1,10 do diff --git a/tests/scope.rs b/tests/scope.rs index 103a9ea..aa1fe9c 100644 --- a/tests/scope.rs +++ b/tests/scope.rs @@ -16,8 +16,7 @@ fn scope_func() { .create_function(move |_, ()| { r.set(42); Ok(()) - }) - .unwrap(); + }).unwrap(); lua.globals().set("bad", f.clone()).unwrap(); f.call::<_, ()>(()).unwrap(); assert_eq!(Rc::strong_count(&rc), 2); @@ -56,8 +55,7 @@ fn scope_drop() { scope .create_static_userdata(MyUserdata(rc.clone())) .unwrap(), - ) - .unwrap(); + ).unwrap(); assert_eq!(Rc::strong_count(&rc), 2); }); assert_eq!(Rc::strong_count(&rc), 1); @@ -78,8 +76,7 @@ fn scope_capture() { .create_function_mut(|_, ()| { i = 42; Ok(()) - }) - .unwrap() + }).unwrap() .call::<_, ()>(()) .unwrap(); }); @@ -95,8 +92,7 @@ fn outer_lua_access() { .create_function_mut(|_, ()| { table.set("a", "b").unwrap(); Ok(()) - }) - .unwrap() + }).unwrap() .call::<_, ()>(()) .unwrap(); }); @@ -125,8 +121,8 @@ fn scope_userdata_methods() { let i = Cell::new(42); lua.scope(|scope| { - let f: Function = - lua.eval( + let f: Function = lua + .eval( r#" function(u) u:inc() @@ -165,8 +161,8 @@ fn scope_userdata_functions() { } let lua = Lua::new(); - let f = - lua.exec::( + let f = lua + .exec::( r#" i = 0 return function(u) diff --git a/tests/table.rs b/tests/table.rs index 1def654..a3c6507 100644 --- a/tests/table.rs +++ b/tests/table.rs @@ -88,8 +88,7 @@ fn test_table() { .set( "table4", lua.create_sequence_from(vec![1, 2, 3, 4, 5]).unwrap(), - ) - .unwrap(); + ).unwrap(); let table4 = globals.get::<_, Table>("table4").unwrap(); assert_eq!( table4.pairs().collect::>>().unwrap(), @@ -132,8 +131,7 @@ fn test_metatable() { .set( "__index", lua.create_function(|_, ()| Ok("index_value")).unwrap(), - ) - .unwrap(); + ).unwrap(); table.set_metatable(Some(metatable)); assert_eq!(table.get::<_, String>("any_key").unwrap(), "index_value"); match table.raw_get::<_, Value>("any_key").unwrap() { diff --git a/tests/tests.rs b/tests/tests.rs index 0527c1c..c31a4e6 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -47,8 +47,8 @@ fn test_exec() { ).unwrap(); assert_eq!(globals.get::<_, String>("res").unwrap(), "foobar"); - let module: Table = - lua.exec( + let module: Table = lua + .exec( r#" local module = {} @@ -324,8 +324,8 @@ fn test_result_conversions() { let lua = Lua::new(); let globals = lua.globals(); - let err = - lua.create_function(|_, ()| { + let err = lua + .create_function(|_, ()| { Ok(Err::( err_msg("only through failure can we succeed").to_lua_err(), )) @@ -520,8 +520,8 @@ fn test_named_registry_value() { let lua = Lua::new(); lua.set_named_registry_value::("test", 42).unwrap(); - let f = - lua.create_function(move |lua, ()| { + let f = lua + .create_function(move |lua, ()| { assert_eq!(lua.named_registry_value::("test")?, 42); Ok(()) }).unwrap(); @@ -540,8 +540,8 @@ fn test_registry_value() { let lua = Lua::new(); let mut r = Some(lua.create_registry_value::(42).unwrap()); - let f = - lua.create_function_mut(move |lua, ()| { + let f = lua + .create_function_mut(move |lua, ()| { if let Some(r) = r.take() { assert_eq!(lua.registry_value::(&r)?, 42); lua.remove_registry_value(r).unwrap(); @@ -692,11 +692,10 @@ fn large_args() { } Ok(s) }).unwrap(), - ) - .unwrap(); + ).unwrap(); - let f: Function = - lua.eval( + let f: Function = lua + .eval( r#" return function(...) return c(...) @@ -716,8 +715,8 @@ fn large_args() { fn large_args_ref() { let lua = Lua::new(); - let f = - lua.create_function(|_, args: Variadic| { + let f = lua + .create_function(|_, args: Variadic| { for i in 0..args.len() { assert_eq!(args[i], i.to_string()); } diff --git a/tests/thread.rs b/tests/thread.rs index c8cc9e5..c33110d 100644 --- a/tests/thread.rs +++ b/tests/thread.rs @@ -7,8 +7,8 @@ use rlua::{Error, Function, Lua, Result, Thread, ThreadStatus}; #[test] fn test_thread() { let lua = Lua::new(); - let thread = - lua.create_thread( + let thread = lua + .create_thread( lua.eval::( r#" function (s) @@ -35,8 +35,8 @@ fn test_thread() { assert_eq!(thread.resume::<_, i64>(4).unwrap(), 10); assert_eq!(thread.status(), ThreadStatus::Unresumable); - let accumulate = - lua.create_thread( + let accumulate = lua + .create_thread( lua.eval::( r#" function (sum) @@ -57,8 +57,8 @@ fn test_thread() { assert!(accumulate.resume::<_, ()>("error").is_err()); assert_eq!(accumulate.status(), ThreadStatus::Error); - let thread = - lua.eval::( + let thread = lua + .eval::( r#" coroutine.create(function () while true do @@ -71,8 +71,8 @@ fn test_thread() { assert_eq!(thread.status(), ThreadStatus::Resumable); assert_eq!(thread.resume::<_, i64>(()).unwrap(), 42); - let thread: Thread = - lua.eval( + let thread: Thread = lua + .eval( r#" coroutine.create(function(arg) assert(arg == 42)