Bladeren bron

`ptr::drop_in_place` looks (and works) a bit better I think

IVogel 2 jaren geleden
bovenliggende
commit
d413c024fe
3 gewijzigde bestanden met toevoegingen van 6 en 6 verwijderingen
  1. 2 2
      src/buffer.rs
  2. 2 2
      src/ldb.rs
  3. 2 2
      src/ltree.rs

+ 2 - 2
src/buffer.rs

@@ -158,9 +158,9 @@ impl Buffer {
 
     fn __gc(state: lua_State) -> Result<i32, Box<dyn std::error::Error>> {
         unsafe {
-            let _ = lua::Lcheckudata(state, 1, lua::cstr!("cslb"))
+            lua::Lcheckudata(state, 1, lua::cstr!("cslb"))
                 .cast::<Self>()
-                .read();
+                .drop_in_place();
             Ok(0)
         }
     }

+ 2 - 2
src/ldb.rs

@@ -289,9 +289,9 @@ impl LDb {
 
     fn __gc(state: lua_State) -> Result<i32, Box<dyn std::error::Error>> {
         unsafe {
-            let _ = lua::Lcheckudata(state, 1, lua::cstr!("csldb"))
+            lua::Lcheckudata(state, 1, lua::cstr!("csldb"))
                 .cast::<Self>()
-                .read();
+                .drop_in_place();
             Ok(0)
         }
     }

+ 2 - 2
src/ltree.rs

@@ -179,9 +179,9 @@ impl LTree {
 
     fn __gc(state: lua_State) -> Result<i32, Box<dyn std::error::Error>> {
         unsafe {
-            let _ = lua::Lcheckudata(state, 1, lua::cstr!("cslt"))
+            lua::Lcheckudata(state, 1, lua::cstr!("cslt"))
                 .cast::<Self>()
-                .read();
+                .drop_in_place();
             Ok(0)
         }
     }