Fix some warnings

This commit is contained in:
SeanOMik 2024-02-18 23:23:59 -05:00
parent 2fe5dca6c4
commit 9b542fb523
Signed by: SeanOMik
GPG Key ID: FEC9E2FC15235964
5 changed files with 4 additions and 8 deletions

View File

@ -1,6 +1,6 @@
use std::borrow::{Borrow, Cow}; use std::borrow::{Borrow, Cow};
use crate::{FromLua, FromLuaVec, Function, IntoLuaVec, State}; use crate::{FromLuaVec, Function, IntoLuaVec, State};
pub struct Chunk<'a> { pub struct Chunk<'a> {
state: &'a State, state: &'a State,

View File

@ -1,6 +1,6 @@
use std::sync::Arc; use std::sync::Arc;
use crate::{Error, PushToLuaStack, Result, StackGuard, State}; use crate::{Error, PushToLuaStack, Result, State};
use mlua_sys as lua; use mlua_sys as lua;

View File

@ -1,7 +1,7 @@
use core::ffi; use core::ffi;
use std::{alloc::{self, Layout}, any::TypeId, cell::RefCell, collections::HashMap, ffi::{CStr, CString}, mem, ptr::{self, NonNull}, str::Utf8Error, sync::Arc}; use std::{alloc::{self, Layout}, any::TypeId, cell::RefCell, collections::HashMap, ffi::{CStr, CString}, mem, ptr::{self, NonNull}, str::Utf8Error, sync::Arc};
use lua::{lua_State, lua_gc}; use lua::lua_gc;
use mlua_sys as lua; use mlua_sys as lua;
use crate::{lua_error_guard, proxy::UserdataProxy, AnyUserdata, AsLua, Chunk, Error, FromLua, FromLuaStack, FromLuaVec, Function, IntoChunkData, IntoLuaVec, LuaRef, MetaMethod, PushToLuaStack, Result, StackGuard, Table, Userdata, UserdataBuilder, Value, ValueVec}; use crate::{lua_error_guard, proxy::UserdataProxy, AnyUserdata, AsLua, Chunk, Error, FromLua, FromLuaStack, FromLuaVec, Function, IntoChunkData, IntoLuaVec, LuaRef, MetaMethod, PushToLuaStack, Result, StackGuard, Table, Userdata, UserdataBuilder, Value, ValueVec};
@ -98,7 +98,6 @@ impl<const N: usize> From<&[StdLibrary; N]> for StdLibraries {
/// A struct that is used as an upvalue for creating Lua callable functions /// A struct that is used as an upvalue for creating Lua callable functions
struct ClosureData<'a> { struct ClosureData<'a> {
wrapper_fn: Box<dyn Fn(&'a State, i32) -> i32>, wrapper_fn: Box<dyn Fn(&'a State, i32) -> i32>,
state: NonNull<State>,
} }
//#[derive(Default)] //#[derive(Default)]
@ -435,7 +434,6 @@ impl State {
let data = ClosureData { let data = ClosureData {
wrapper_fn: Box::new(wrapper_fn), wrapper_fn: Box::new(wrapper_fn),
state: NonNull::from(self),
}; };
let s = self.state_ptr(); let s = self.state_ptr();

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData; use std::marker::PhantomData;
use crate::{AsLua, State, Userdata, UserdataBuilder, Value}; use crate::{State, Userdata, UserdataBuilder};
pub struct UserdataProxy<T: Userdata>(PhantomData<T>); pub struct UserdataProxy<T: Userdata>(PhantomData<T>);

View File

@ -369,8 +369,6 @@ impl<'a> ValueVec<'a> {
/// Gets a ValueVec from the stack with a limit /// Gets a ValueVec from the stack with a limit
pub fn from_stack_limit(state: &'a State, limit: usize) -> crate::Result<ValueVec<'a>> { pub fn from_stack_limit(state: &'a State, limit: usize) -> crate::Result<ValueVec<'a>> {
unsafe { unsafe {
let s = state.state_ptr();
let mut vec = VecDeque::new(); let mut vec = VecDeque::new();
for _ in 1..(limit + 1) { for _ in 1..(limit + 1) {
let v = Value::from_lua_stack(state)?; let v = Value::from_lua_stack(state)?;