Fix clippy lints in serde builtin

This commit is contained in:
Filip Tibell 2024-04-20 16:48:28 +02:00
parent 66ed1a0b72
commit 53463641b8
No known key found for this signature in database
2 changed files with 8 additions and 15 deletions

View file

@ -87,11 +87,7 @@ impl EncodeDecodeConfig {
lua.create_string(bytes)
}
pub fn deserialize_from_string<'lua>(
self,
lua: &'lua Lua,
string: BString,
) -> LuaResult<LuaValue<'lua>> {
pub fn deserialize_from_string(self, lua: &Lua, string: BString) -> LuaResult<LuaValue> {
let bytes = string.as_bytes();
match self.format {
EncodeDecodeFormat::Json => {

View file

@ -26,26 +26,23 @@ fn serde_encode<'lua>(
config.serialize_to_string(lua, val)
}
fn serde_decode<'lua>(
lua: &'lua Lua,
(format, str): (EncodeDecodeFormat, BString),
) -> LuaResult<LuaValue<'lua>> {
fn serde_decode(lua: &Lua, (format, str): (EncodeDecodeFormat, BString)) -> LuaResult<LuaValue> {
let config = EncodeDecodeConfig::from(format);
config.deserialize_from_string(lua, str)
}
async fn serde_compress<'lua>(
lua: &'lua Lua,
async fn serde_compress(
lua: &Lua,
(format, str): (CompressDecompressFormat, BString),
) -> LuaResult<LuaString<'lua>> {
) -> LuaResult<LuaString> {
let bytes = compress(format, str).await?;
lua.create_string(bytes)
}
async fn serde_decompress<'lua>(
lua: &'lua Lua,
async fn serde_decompress(
lua: &Lua,
(format, str): (CompressDecompressFormat, BString),
) -> LuaResult<LuaString<'lua>> {
) -> LuaResult<LuaString> {
let bytes = decompress(format, str).await?;
lua.create_string(bytes)
}