From 790df77965e9ea2dceb3544325fb1ba74f57e65a Mon Sep 17 00:00:00 2001 From: Alex Orlenko Date: Sun, 17 Apr 2022 22:39:21 +0100 Subject: [PATCH] Fix "unused" warning in tests --- tests/static.rs | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/tests/static.rs b/tests/static.rs index 471debd..5bc286b 100644 --- a/tests/static.rs +++ b/tests/static.rs @@ -1,6 +1,6 @@ use std::cell::RefCell; -use mlua::{Function, Lua, Result, Table}; +use mlua::{Lua, Result, Table}; #[test] fn test_static_lua() -> Result<()> { @@ -73,16 +73,17 @@ fn test_static_lua_coroutine() -> Result<()> { async fn test_static_async() -> Result<()> { let lua = Lua::new().into_static(); - let timer = lua.create_async_function(|_, (i, n, f): (u64, u64, Function)| async move { - tokio::task::spawn_local(async move { - let dur = std::time::Duration::from_millis(i); - for _ in 0..n { - tokio::task::spawn_local(f.call_async::<(), ()>(())); - tokio::time::sleep(dur).await; - } - }); - Ok(()) - })?; + let timer = + lua.create_async_function(|_, (i, n, f): (u64, u64, mlua::Function)| async move { + tokio::task::spawn_local(async move { + let dur = std::time::Duration::from_millis(i); + for _ in 0..n { + tokio::task::spawn_local(f.call_async::<(), ()>(())); + tokio::time::sleep(dur).await; + } + }); + Ok(()) + })?; lua.globals().set("timer", timer)?; {