cargo fmt
This commit is contained in:
parent
2bbb203050
commit
58e5c7b18b
|
@ -61,7 +61,7 @@ impl<'lua> FromLua<'lua> for String<'lua> {
|
||||||
from: value.type_name(),
|
from: value.type_name(),
|
||||||
to: "string",
|
to: "string",
|
||||||
message: None,
|
message: None,
|
||||||
})
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -287,7 +287,11 @@ impl<'lua> FromLua<'lua> for Error {
|
||||||
fn from_lua(value: Value<'lua>, _: &'lua Lua) -> Result<Error> {
|
fn from_lua(value: Value<'lua>, _: &'lua Lua) -> Result<Error> {
|
||||||
match value {
|
match value {
|
||||||
Value::Error(err) => Ok(err),
|
Value::Error(err) => Ok(err),
|
||||||
_ => Err(Error::FromLuaConversionError { from: value.type_name(), to: "error", message: None }),
|
_ => Err(Error::FromLuaConversionError {
|
||||||
|
from: value.type_name(),
|
||||||
|
to: "error",
|
||||||
|
message: None,
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -312,7 +316,11 @@ impl<'lua> FromLua<'lua> for bool {
|
||||||
match value {
|
match value {
|
||||||
Value::Nil => Ok(false),
|
Value::Nil => Ok(false),
|
||||||
Value::Boolean(b) => Ok(b),
|
Value::Boolean(b) => Ok(b),
|
||||||
_ => Err(Error::FromLuaConversionError { from: value.type_name(), to: "boolean", message: None }),
|
_ => Err(Error::FromLuaConversionError {
|
||||||
|
from: value.type_name(),
|
||||||
|
to: "boolean",
|
||||||
|
message: None,
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -324,7 +332,6 @@ impl<'lua> From<LightUserData> for Value<'lua> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl<'lua> IntoLua<'lua> for LightUserData {
|
impl<'lua> IntoLua<'lua> for LightUserData {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn into_lua(self, _: &'lua Lua) -> Result<Value<'lua>> {
|
fn into_lua(self, _: &'lua Lua) -> Result<Value<'lua>> {
|
||||||
|
@ -354,7 +361,6 @@ impl<'lua> From<crate::types::Vector> for Value<'lua> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[cfg(feature = "luau")]
|
#[cfg(feature = "luau")]
|
||||||
impl<'lua> IntoLua<'lua> for crate::types::Vector {
|
impl<'lua> IntoLua<'lua> for crate::types::Vector {
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -439,7 +445,7 @@ impl<'lua> FromLua<'lua> for CString {
|
||||||
to: "CString",
|
to: "CString",
|
||||||
message: Some(e.to_string()),
|
message: Some(e.to_string()),
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
10
src/lua.rs
10
src/lua.rs
|
@ -1571,7 +1571,11 @@ impl Lua {
|
||||||
/// # Safety
|
/// # Safety
|
||||||
/// This function is unsafe because provides a way to execute unsafe C function.
|
/// This function is unsafe because provides a way to execute unsafe C function.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn create_c_closure<'lua>(&'lua self, func: ffi::lua_CFunction, upvalues: impl IntoLuaMulti<'lua>) -> Result<Function> {
|
pub unsafe fn create_c_closure<'lua>(
|
||||||
|
&'lua self,
|
||||||
|
func: ffi::lua_CFunction,
|
||||||
|
upvalues: impl IntoLuaMulti<'lua>,
|
||||||
|
) -> Result<Function> {
|
||||||
let state = self.state();
|
let state = self.state();
|
||||||
let upvalues = upvalues.into_lua_multi(self)?;
|
let upvalues = upvalues.into_lua_multi(self)?;
|
||||||
let Ok(n) = i32::try_from(upvalues.len()) else {
|
let Ok(n) = i32::try_from(upvalues.len()) else {
|
||||||
|
@ -2819,7 +2823,9 @@ impl Lua {
|
||||||
))]
|
))]
|
||||||
unsafe {
|
unsafe {
|
||||||
if !(*self.extra.get()).libs.contains(StdLib::COROUTINE) {
|
if !(*self.extra.get()).libs.contains(StdLib::COROUTINE) {
|
||||||
return Err(Error::RuntimeError("StdLib::COROUTINE is not loaded".to_owned()));
|
return Err(Error::RuntimeError(
|
||||||
|
"StdLib::COROUTINE is not loaded".to_owned(),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue