Skip to content

Commit

Permalink
fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
HTGAzureX1212 committed Nov 1, 2024
1 parent 9e499d1 commit ddf2531
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ pub struct Appearance {
pub nickname: Option<String>,
}

impl<'lua> FromLua<'lua> for Appearance {
fn from_lua(lua_value: Value<'lua>, _: &'lua Lua) -> mlua::Result<Self> {
impl FromLua for Appearance {
fn from_lua(lua_value: Value, _: &Lua) -> mlua::Result<Self> {
let Value::Table(table) = lua_value.clone() else {
return Err(Error::RuntimeError(format!(
"Appearance: mismatched value type, expected table, found: {}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ pub struct Dashboard {
pub viewers: Option<Vec<String>>,
}

impl<'lua> FromLua<'lua> for Dashboard {
fn from_lua(lua_value: Value<'lua>, _: &'lua Lua) -> mlua::Result<Self> {
impl FromLua for Dashboard {
fn from_lua(lua_value: Value, _: &Lua) -> mlua::Result<Self> {
let Value::Table(table) = lua_value.clone() else {
return Err(Error::RuntimeError(format!(
"Dashboard: mismatched value type, expected table, found: {}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ bitflags::bitflags! {
}
}

impl<'lua> FromLua<'lua> for EventFlags {
fn from_lua(lua_value: Value<'lua>, _: &'lua Lua) -> mlua::Result<Self> {
impl FromLua for EventFlags {
fn from_lua(lua_value: Value, _: &Lua) -> mlua::Result<Self> {
let Value::Table(table) = lua_value.clone() else {
return Err(Error::RuntimeError(format!(
"EventFlags: mismatched value type, expected table, found: {}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#![deny(clippy::pedantic)]
#![deny(unsafe_code)]
#![deny(warnings)]
#![feature(str_as_str)]
#![feature(result_flattening)]

use mlua::Error;
Expand All @@ -52,8 +53,8 @@ pub struct Configuration {
pub plugins: Option<plugins::Plugins>,
}

impl<'lua> FromLuaMulti<'lua> for Configuration {
fn from_lua_multi(values: MultiValue<'lua>, _: &'lua Lua) -> mlua::Result<Self> {
impl FromLuaMulti for Configuration {
fn from_lua_multi(values: MultiValue, _: &Lua) -> mlua::Result<Self> {
if values.is_empty() {
return Err(Error::RuntimeError(String::from(
"Configuration: multi value is empty",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ pub struct ManagementPlugin {
pub enabled: bool,
}

impl<'lua> FromLua<'lua> for ManagementPlugin {
fn from_lua(lua_value: Value<'lua>, _: &'lua Lua) -> mlua::Result<Self> {
impl FromLua for ManagementPlugin {
fn from_lua(lua_value: Value, _: &Lua) -> mlua::Result<Self> {
let Value::Table(table) = lua_value.clone() else {
return Err(Error::RuntimeError(format!(
"ManagementPlugin: mismatched value type, expected table, found: {}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ pub struct Plugins {
pub utilities: Option<utilities::UtilitiesPlugin>,
}

impl<'lua> FromLua<'lua> for Plugins {
fn from_lua(lua_value: Value<'lua>, _: &'lua Lua) -> mlua::Result<Self> {
impl FromLua for Plugins {
fn from_lua(lua_value: Value, _: &Lua) -> mlua::Result<Self> {
let Value::Table(table) = lua_value.clone() else {
return Err(Error::RuntimeError(format!(
"Dashboard: mismatched value type, expected table, found: {}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ pub struct ModlogLogger {
pub format: ModlogFormat,
}

impl<'lua> FromLua<'lua> for ModlogLogger {
fn from_lua(lua_value: Value<'lua>, _: &'lua Lua) -> mlua::Result<Self> {
impl FromLua for ModlogLogger {
fn from_lua(lua_value: Value, _: &Lua) -> mlua::Result<Self> {
let Value::Table(table) = lua_value.clone() else {
return Err(Error::RuntimeError(format!(
"ModlogPlugin: mismatched value type, expected table, found: {}",
Expand Down Expand Up @@ -78,8 +78,8 @@ impl Default for ModlogFormat {
}
}

impl<'lua> FromLua<'lua> for ModlogFormat {
fn from_lua(lua_value: Value<'lua>, _: &'lua Lua) -> mlua::Result<Self> {
impl FromLua for ModlogFormat {
fn from_lua(lua_value: Value, _: &Lua) -> mlua::Result<Self> {
let Value::String(string) = lua_value.clone() else {
return Err(Error::RuntimeError(format!(
"ModlogFormat: mismatched value type, expected string, found: {}",
Expand All @@ -93,7 +93,7 @@ impl<'lua> FromLua<'lua> for ModlogFormat {
)));
};

Ok(match rust_string {
Ok(match rust_string.as_str() {
"default" => Self::Default,
"pretty" => Self::Pretty,
_ => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ pub struct ModlogPlugin {
pub loggers: Vec<logger::ModlogLogger>,
}

impl<'lua> FromLua<'lua> for ModlogPlugin {
fn from_lua(lua_value: Value<'lua>, _: &'lua Lua) -> mlua::Result<Self> {
impl FromLua for ModlogPlugin {
fn from_lua(lua_value: Value, _: &Lua) -> mlua::Result<Self> {
let Value::Table(table) = lua_value.clone() else {
return Err(Error::RuntimeError(format!(
"ModlogPlugin: mismatched value type, expected table, found: {}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ pub struct UtilitiesPlugin {
pub enabled: bool,
}

impl<'lua> FromLua<'lua> for UtilitiesPlugin {
fn from_lua(lua_value: Value<'lua>, _: &'lua Lua) -> mlua::Result<Self> {
impl FromLua for UtilitiesPlugin {
fn from_lua(lua_value: Value, _: &Lua) -> mlua::Result<Self> {
let Value::Table(table) = lua_value.clone() else {
return Err(Error::RuntimeError(format!(
"UtilitiesPlugin: mismatched value type, expected table, found: {}",
Expand Down

0 comments on commit ddf2531

Please sign in to comment.