Skip to content

Fix various warnings from rustc #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion hlua/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ pub unsafe trait AsMutLua: AsLua {

/// Opaque type that contains the raw Lua context.
#[derive(Copy, Clone)]
#[allow(raw_pointer_derive)]
pub struct LuaContext(*mut ffi::lua_State);
unsafe impl Send for LuaContext {}

Expand Down
12 changes: 6 additions & 6 deletions hlua/src/userdata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use LuaRead;
use InsideCallback;
use LuaTable;

extern fn destructor_wrapper(lua: *mut ffi::lua_State) -> libc::c_int {
extern "C" fn destructor_wrapper(lua: *mut ffi::lua_State) -> libc::c_int {
let impl_raw = unsafe { ffi::lua_touserdata(lua, ffi::lua_upvalueindex(1)) };
let imp: fn(*mut ffi::lua_State)->::libc::c_int = unsafe { mem::transmute(impl_raw) };

Expand Down Expand Up @@ -76,7 +76,7 @@ pub fn push_userdata<L, T, F>(data: T, mut lua: L, mut metatable: F) -> PushGuar
ffi::lua_pushlightuserdata(lua.as_mut_lua().0, mem::transmute(destructor_impl));

// pushing destructor_wrapper as a closure
ffi::lua_pushcclosure(lua.as_mut_lua().0, mem::transmute(destructor_wrapper), 1);
ffi::lua_pushcclosure(lua.as_mut_lua().0, destructor_wrapper, 1);

ffi::lua_settable(lua.as_mut_lua().0, -3);
}
Expand All @@ -94,12 +94,12 @@ pub fn push_userdata<L, T, F>(data: T, mut lua: L, mut metatable: F) -> PushGuar
PushGuard { lua: lua, size: 1 }
}

///
///
pub fn read_userdata<'t, 'c, T>(mut lua: &'c mut InsideCallback, index: i32)
-> Result<&'t mut T, &'c mut InsideCallback>
where T: 'static + Any
{
assert!(index == -1); // FIXME:
assert!(index == -1); // FIXME:

unsafe {
let expected_typeid = format!("{:?}", TypeId::of::<T>());
Expand Down Expand Up @@ -135,7 +135,7 @@ pub struct UserdataOnStack<T, L> {

impl<T, L> LuaRead<L> for UserdataOnStack<T, L> where L: AsMutLua + AsLua, T: 'static + Any {
fn lua_read_at_position(mut lua: L, index: i32) -> Result<UserdataOnStack<T, L>, L> {
assert!(index == -1); // FIXME:
assert!(index == -1); // FIXME:

unsafe {
let expected_typeid = format!("{:?}", TypeId::of::<T>());
Expand Down Expand Up @@ -172,7 +172,7 @@ impl<T, L> Deref for UserdataOnStack<T, L> where L: AsMutLua, T: 'static + Any {
type Target = T;

fn deref(&self) -> &T {
let me: &mut UserdataOnStack<T, L> = unsafe { mem::transmute(self) }; // FIXME:
let me: &mut UserdataOnStack<T, L> = unsafe { mem::transmute(self) }; // FIXME:
let data = unsafe { ffi::lua_touserdata(me.variable.as_mut_lua().0, -1) };
let data: &T = unsafe { mem::transmute(data) };
data
Expand Down
1 change: 1 addition & 0 deletions lua52-sys/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(improper_ctypes)]

extern crate libc;

Expand Down