mirror of
https://github.com/lune-org/lune.git
synced 2024-12-12 13:00:37 +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)
|
lua.create_string(bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn deserialize_from_string<'lua>(
|
pub fn deserialize_from_string(self, lua: &Lua, string: BString) -> LuaResult<LuaValue> {
|
||||||
self,
|
|
||||||
lua: &'lua Lua,
|
|
||||||
string: BString,
|
|
||||||
) -> LuaResult<LuaValue<'lua>> {
|
|
||||||
let bytes = string.as_bytes();
|
let bytes = string.as_bytes();
|
||||||
match self.format {
|
match self.format {
|
||||||
EncodeDecodeFormat::Json => {
|
EncodeDecodeFormat::Json => {
|
||||||
|
|
|
@ -26,26 +26,23 @@ fn serde_encode<'lua>(
|
||||||
config.serialize_to_string(lua, val)
|
config.serialize_to_string(lua, val)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn serde_decode<'lua>(
|
fn serde_decode(lua: &Lua, (format, str): (EncodeDecodeFormat, BString)) -> LuaResult<LuaValue> {
|
||||||
lua: &'lua Lua,
|
|
||||||
(format, str): (EncodeDecodeFormat, BString),
|
|
||||||
) -> LuaResult<LuaValue<'lua>> {
|
|
||||||
let config = EncodeDecodeConfig::from(format);
|
let config = EncodeDecodeConfig::from(format);
|
||||||
config.deserialize_from_string(lua, str)
|
config.deserialize_from_string(lua, str)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn serde_compress<'lua>(
|
async fn serde_compress(
|
||||||
lua: &'lua Lua,
|
lua: &Lua,
|
||||||
(format, str): (CompressDecompressFormat, BString),
|
(format, str): (CompressDecompressFormat, BString),
|
||||||
) -> LuaResult<LuaString<'lua>> {
|
) -> LuaResult<LuaString> {
|
||||||
let bytes = compress(format, str).await?;
|
let bytes = compress(format, str).await?;
|
||||||
lua.create_string(bytes)
|
lua.create_string(bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn serde_decompress<'lua>(
|
async fn serde_decompress(
|
||||||
lua: &'lua Lua,
|
lua: &Lua,
|
||||||
(format, str): (CompressDecompressFormat, BString),
|
(format, str): (CompressDecompressFormat, BString),
|
||||||
) -> LuaResult<LuaString<'lua>> {
|
) -> LuaResult<LuaString> {
|
||||||
let bytes = decompress(format, str).await?;
|
let bytes = decompress(format, str).await?;
|
||||||
lua.create_string(bytes)
|
lua.create_string(bytes)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue