cargo fmt

This commit is contained in:
Michael Pfaff 2023-07-06 13:33:22 -04:00
parent 2bbb203050
commit 58e5c7b18b
Signed by: michael
GPG Key ID: CF402C4A012AA9D4
2 changed files with 20 additions and 8 deletions

View File

@ -61,7 +61,7 @@ impl<'lua> FromLua<'lua> for String<'lua> {
from: value.type_name(),
to: "string",
message: None,
})
}),
}
}
}
@ -287,7 +287,11 @@ impl<'lua> FromLua<'lua> for Error {
fn from_lua(value: Value<'lua>, _: &'lua Lua) -> Result<Error> {
match value {
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 {
Value::Nil => Ok(false),
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 {
#[inline]
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")]
impl<'lua> IntoLua<'lua> for crate::types::Vector {
#[inline]
@ -439,7 +445,7 @@ impl<'lua> FromLua<'lua> for CString {
to: "CString",
message: Some(e.to_string()),
}),
}
}
}
}

View File

@ -1571,7 +1571,11 @@ impl Lua {
/// # Safety
/// This function is unsafe because provides a way to execute unsafe C function.
#[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 upvalues = upvalues.into_lua_multi(self)?;
let Ok(n) = i32::try_from(upvalues.len()) else {
@ -2819,7 +2823,9 @@ impl Lua {
))]
unsafe {
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(),
));
}
}