summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Orlenko <zxteam@protonmail.com>2024-03-23 11:42:46 +0000
committerAlex Orlenko <zxteam@protonmail.com>2024-03-23 11:42:46 +0000
commita79840afc903b14d14412e0075a4e0a1c640b798 (patch)
tree43ba3d798bb2d3445a67a29f3a4292dd8e62ef97
parent39afe4c6f7aa8f87266029bfcc1bd06224c5f268 (diff)
downloadmlua-a79840afc903b14d14412e0075a4e0a1c640b798.zip
Suppress Rust 1.77 dead_code false warnings.
-rw-r--r--benches/benchmark.rs4
-rw-r--r--src/userdata.rs4
-rw-r--r--tests/memory.rs2
-rw-r--r--tests/scope.rs20
-rw-r--r--tests/serde.rs2
-rw-r--r--tests/tests.rs2
-rw-r--r--tests/thread.rs2
-rw-r--r--tests/userdata.rs2
8 files changed, 19 insertions, 19 deletions
diff --git a/benches/benchmark.rs b/benches/benchmark.rs
index 014bd3a..245bd35 100644
--- a/benches/benchmark.rs
+++ b/benches/benchmark.rs
@@ -269,7 +269,7 @@ fn registry_value_create(c: &mut Criterion) {
}
fn userdata_create(c: &mut Criterion) {
- struct UserData(i64);
+ struct UserData(#[allow(unused)] i64);
impl LuaUserData for UserData {}
let lua = Lua::new();
@@ -286,7 +286,7 @@ fn userdata_create(c: &mut Criterion) {
}
fn userdata_call_index(c: &mut Criterion) {
- struct UserData(i64);
+ struct UserData(#[allow(unused)] i64);
impl LuaUserData for UserData {
fn add_methods<'lua, M: LuaUserDataMethods<'lua, Self>>(methods: &mut M) {
methods.add_meta_method(LuaMetaMethod::Index, move |_, _, key: LuaString| Ok(key));
diff --git a/src/userdata.rs b/src/userdata.rs
index 04d6223..e2c4a74 100644
--- a/src/userdata.rs
+++ b/src/userdata.rs
@@ -1358,7 +1358,7 @@ impl<'lua> Serialize for AnyUserData<'lua> {
/// A wrapper type for an immutably borrowed value from a `AnyUserData`.
///
/// It implements [`FromLua`] and can be used to receive a typed userdata from Lua.
-pub struct UserDataRef<'lua, T: 'static>(AnyUserData<'lua>, Ref<'lua, T>);
+pub struct UserDataRef<'lua, T: 'static>(#[allow(unused)] AnyUserData<'lua>, Ref<'lua, T>);
impl<'lua, T: 'static> Deref for UserDataRef<'lua, T> {
type Target = T;
@@ -1380,7 +1380,7 @@ impl<'lua, T: 'static> UserDataRef<'lua, T> {
/// A wrapper type for a mutably borrowed value from a `AnyUserData`.
///
/// It implements [`FromLua`] and can be used to receive a typed userdata from Lua.
-pub struct UserDataRefMut<'lua, T: 'static>(AnyUserData<'lua>, RefMut<'lua, T>);
+pub struct UserDataRefMut<'lua, T: 'static>(#[allow(unused)] AnyUserData<'lua>, RefMut<'lua, T>);
impl<'lua, T: 'static> Deref for UserDataRefMut<'lua, T> {
type Target = T;
diff --git a/tests/memory.rs b/tests/memory.rs
index 6c3d2e1..0f9e8d0 100644
--- a/tests/memory.rs
+++ b/tests/memory.rs
@@ -84,7 +84,7 @@ fn test_gc_control() -> Result<()> {
assert_eq!(lua.gc_inc(200, 100, 13), GCMode::Incremental);
- struct MyUserdata(Arc<()>);
+ struct MyUserdata(#[allow(unused)] Arc<()>);
impl UserData for MyUserdata {}
let rc = Arc::new(());
diff --git a/tests/scope.rs b/tests/scope.rs
index 1cd5fc4..b04b7b5 100644
--- a/tests/scope.rs
+++ b/tests/scope.rs
@@ -155,14 +155,14 @@ fn test_scope_userdata_functions() -> Result<()> {
impl<'a> UserData for MyUserData<'a> {
fn add_methods<'lua, M: UserDataMethods<'lua, Self>>(methods: &mut M) {
- methods.add_meta_function(MetaMethod::Add, |lua, ()| {
+ methods.add_meta_method(MetaMethod::Add, |lua, this, ()| {
let globals = lua.globals();
- globals.set("i", globals.get::<_, i64>("i")? + 1)?;
+ globals.set("i", globals.get::<_, i64>("i")? + this.0)?;
Ok(())
});
- methods.add_meta_function(MetaMethod::Sub, |lua, ()| {
+ methods.add_meta_method(MetaMethod::Sub, |lua, this, ()| {
let globals = lua.globals();
- globals.set("i", globals.get::<_, i64>("i")? + 1)?;
+ globals.set("i", globals.get::<_, i64>("i")? + this.0)?;
Ok(())
});
}
@@ -170,7 +170,7 @@ fn test_scope_userdata_functions() -> Result<()> {
let lua = Lua::new();
- let dummy = 0;
+ let dummy = 1;
let f = lua
.load(
r#"
@@ -178,7 +178,7 @@ fn test_scope_userdata_functions() -> Result<()> {
return function(u)
_ = u + u
_ = u - 1
- _ = 1 + u
+ _ = u + 1
end
"#,
)
@@ -257,7 +257,7 @@ fn test_scope_userdata_mismatch() -> Result<()> {
fn test_scope_userdata_drop() -> Result<()> {
let lua = Lua::new();
- struct MyUserData(Rc<()>);
+ struct MyUserData(#[allow(unused)] Rc<()>);
impl UserData for MyUserData {
fn add_methods<'lua, M: UserDataMethods<'lua, Self>>(methods: &mut M) {
@@ -265,7 +265,7 @@ fn test_scope_userdata_drop() -> Result<()> {
}
}
- struct MyUserDataArc(Arc<()>);
+ struct MyUserDataArc(#[allow(unused)] Arc<()>);
impl UserData for MyUserDataArc {}
@@ -315,7 +315,7 @@ fn test_scope_userdata_drop() -> Result<()> {
fn test_scope_nonstatic_userdata_drop() -> Result<()> {
let lua = Lua::new();
- struct MyUserData<'a>(&'a Cell<i64>, Arc<()>);
+ struct MyUserData<'a>(&'a Cell<i64>, #[allow(unused)] Arc<()>);
impl<'a> UserData for MyUserData<'a> {
fn add_methods<'lua, M: UserDataMethods<'lua, Self>>(methods: &mut M) {
@@ -326,7 +326,7 @@ fn test_scope_nonstatic_userdata_drop() -> Result<()> {
}
}
- struct MyUserDataArc(Arc<()>);
+ struct MyUserDataArc(#[allow(unused)] Arc<()>);
impl UserData for MyUserDataArc {}
diff --git a/tests/serde.rs b/tests/serde.rs
index d7a6801..7e2e251 100644
--- a/tests/serde.rs
+++ b/tests/serde.rs
@@ -99,7 +99,7 @@ fn test_serialize_in_scope() -> LuaResult<()> {
Err(e) => panic!("expected destructed error, got {}", e),
}
- struct MyUserDataRef<'a>(&'a ());
+ struct MyUserDataRef<'a>(#[allow(unused)] &'a ());
impl<'a> UserData for MyUserDataRef<'a> {}
diff --git a/tests/tests.rs b/tests/tests.rs
index 4d072bb..9dd6a00 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -743,7 +743,7 @@ fn test_registry_value() -> Result<()> {
#[test]
fn test_drop_registry_value() -> Result<()> {
- struct MyUserdata(Arc<()>);
+ struct MyUserdata(#[allow(unused)] Arc<()>);
impl UserData for MyUserdata {}
diff --git a/tests/thread.rs b/tests/thread.rs
index 06bae95..83beb4f 100644
--- a/tests/thread.rs
+++ b/tests/thread.rs
@@ -101,7 +101,7 @@ fn test_thread_reset() -> Result<()> {
let lua = Lua::new();
- struct MyUserData(Arc<()>);
+ struct MyUserData(#[allow(unused)] Arc<()>);
impl UserData for MyUserData {}
let arc = Arc::new(());
diff --git a/tests/userdata.rs b/tests/userdata.rs
index dca5ed2..7d5b623 100644
--- a/tests/userdata.rs
+++ b/tests/userdata.rs
@@ -402,7 +402,7 @@ fn test_userdata_take() -> Result<()> {
#[test]
fn test_userdata_destroy() -> Result<()> {
- struct MyUserdata(Arc<()>);
+ struct MyUserdata(#[allow(unused)] Arc<()>);
impl UserData for MyUserdata {}