From 9596f2e9ee66d8f11c599d1465d92a6695c69bd3 Mon Sep 17 00:00:00 2001 From: Alex Orlenko Date: Sat, 3 Jun 2023 14:24:34 +0100 Subject: [PATCH] Fix warning when compiling for lua51 --- src/function.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/function.rs b/src/function.rs index df6b952..84353d6 100644 --- a/src/function.rs +++ b/src/function.rs @@ -1,5 +1,4 @@ use std::cell::RefCell; -use std::ffi::CStr; use std::mem; use std::os::raw::{c_int, c_void}; use std::ptr; @@ -325,7 +324,7 @@ impl<'lua> Function<'lua> { // Traverse upvalues until we find the _ENV one match ffi::lua_getupvalue(state, -1, i) { s if s.is_null() => break, - s if CStr::from_ptr(s as _).to_bytes() == b"_ENV" => break, + s if std::ffi::CStr::from_ptr(s as _).to_bytes() == b"_ENV" => break, _ => ffi::lua_pop(state, 1), } } @@ -374,7 +373,7 @@ impl<'lua> Function<'lua> { for i in 1..=255 { match ffi::lua_getupvalue(state, -1, i) { s if s.is_null() => return Ok(false), - s if CStr::from_ptr(s as _).to_bytes() == b"_ENV" => { + s if std::ffi::CStr::from_ptr(s as _).to_bytes() == b"_ENV" => { ffi::lua_pop(state, 1); // Create an anonymous function with the new environment let f_with_env = lua