From 53463641b8588c62a9d253db71f90017a9fcb5ef Mon Sep 17 00:00:00 2001 From: Filip Tibell Date: Sat, 20 Apr 2024 16:48:28 +0200 Subject: [PATCH] Fix clippy lints in serde builtin --- src/lune/builtins/serde/encode_decode.rs | 6 +----- src/lune/builtins/serde/mod.rs | 17 +++++++---------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/lune/builtins/serde/encode_decode.rs b/src/lune/builtins/serde/encode_decode.rs index d8bae5c..8457a25 100644 --- a/src/lune/builtins/serde/encode_decode.rs +++ b/src/lune/builtins/serde/encode_decode.rs @@ -87,11 +87,7 @@ impl EncodeDecodeConfig { lua.create_string(bytes) } - pub fn deserialize_from_string<'lua>( - self, - lua: &'lua Lua, - string: BString, - ) -> LuaResult> { + pub fn deserialize_from_string(self, lua: &Lua, string: BString) -> LuaResult { let bytes = string.as_bytes(); match self.format { EncodeDecodeFormat::Json => { diff --git a/src/lune/builtins/serde/mod.rs b/src/lune/builtins/serde/mod.rs index 910cb59..de351a3 100644 --- a/src/lune/builtins/serde/mod.rs +++ b/src/lune/builtins/serde/mod.rs @@ -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> { +fn serde_decode(lua: &Lua, (format, str): (EncodeDecodeFormat, BString)) -> LuaResult { 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> { +) -> LuaResult { 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> { +) -> LuaResult { let bytes = decompress(format, str).await?; lua.create_string(bytes) }