diff --git a/src/function.rs b/src/function.rs index 3d37894..9c40d91 100644 --- a/src/function.rs +++ b/src/function.rs @@ -187,7 +187,7 @@ impl<'lua> Function<'lua> { /// /// If `strip` is true, the binary representation may not include all debug information /// about the function, to save space. - pub fn dump(&self, strip: bool) -> Result> { + pub fn dump(&self, strip: bool) -> Vec { unsafe extern "C" fn writer( _state: *mut ffi::lua_State, buf: *const c_void, @@ -213,7 +213,7 @@ impl<'lua> Function<'lua> { ffi::lua_pop(lua.state, 1); } - Ok(data) + data } } diff --git a/tests/function.rs b/tests/function.rs index dd34ae6..b29fb81 100644 --- a/tests/function.rs +++ b/tests/function.rs @@ -83,7 +83,7 @@ fn test_dump() -> Result<()> { let concat_lua = lua .load(r#"function(arg1, arg2) return arg1 .. arg2 end"#) .eval::()?; - let concat = lua.load(&concat_lua.dump(false)?).into_function()?; + let concat = lua.load(&concat_lua.dump(false)).into_function()?; assert_eq!(concat.call::<_, String>(("foo", "bar"))?, "foobar"); diff --git a/tests/tests.rs b/tests/tests.rs index f2b2d4a..d34238a 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -52,7 +52,7 @@ fn test_safety() -> Result<()> { Ok(_) => panic!("expected SafetyError, got no error"), } - let bytecode = lua.load("return 1 + 1").into_function()?.dump(true)?; + let bytecode = lua.load("return 1 + 1").into_function()?.dump(true); match lua.load(&bytecode).exec() { Err(Error::SafetyError(msg)) => { assert!(msg.contains("binary chunks are disabled in safe mode")) @@ -162,7 +162,7 @@ fn test_load_mode() -> Result<()> { Err(e) => panic!("expected SyntaxError, got {:?}", e), }; - let bytecode = lua.load("return 1 + 1").into_function()?.dump(true)?; + let bytecode = lua.load("return 1 + 1").into_function()?.dump(true); assert_eq!(lua.load(&bytecode).eval::()?, 2); assert_eq!( lua.load(&bytecode)