Minor serde optimizations

This commit is contained in:
Alex Orlenko 2022-10-23 03:13:24 +01:00
parent 65396a910f
commit cca177df5b
No known key found for this signature in database
GPG key ID: 4C150C250863B96D
2 changed files with 4 additions and 8 deletions

View file

@ -71,7 +71,7 @@ impl Options {
///
/// [`deny_recursive_tables`]: #structfield.deny_recursive_tables
#[must_use]
pub fn deny_recursive_tables(mut self, enabled: bool) -> Self {
pub const fn deny_recursive_tables(mut self, enabled: bool) -> Self {
self.deny_recursive_tables = enabled;
self
}

View file

@ -10,7 +10,7 @@ use crate::ffi;
use crate::lua::Lua;
use crate::table::Table;
use crate::types::LightUserData;
use crate::util::{assert_stack, check_stack, StackGuard};
use crate::util::check_stack;
use crate::value::Value;
/// Trait for serializing/deserializing Lua values using Serde.
@ -205,12 +205,8 @@ impl<'lua> LuaSerdeExt<'lua> for Lua {
fn array_metatable(&'lua self) -> Table<'lua> {
unsafe {
let _sg = StackGuard::new(self.state);
assert_stack(self.state, 1);
push_array_metatable(self.state);
Table(self.pop_ref())
push_array_metatable(self.ref_thread());
Table(self.pop_ref_thread())
}
}