mirror of
https://github.com/lune-org/lune.git
synced 2024-12-12 04:50:36 +00:00
Fix clippy lints in serde builtin
This commit is contained in:
parent
66ed1a0b72
commit
53463641b8
2 changed files with 8 additions and 15 deletions
|
@ -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 => {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue