Skip to content

Commit

Permalink
Remove Redundant Deserialization
Browse files Browse the repository at this point in the history
  • Loading branch information
JopStro committed May 6, 2024
1 parent bd74c92 commit 8d8fb6c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ fn decode<'lua>(lua: &'lua Lua, s: LuaValue<'lua>) -> LuaResult<LuaValue<'lua>>
}

fn encode<'lua>(lua: &'lua Lua, v: LuaValue<'lua>) -> LuaResult<LuaValue<'lua>> {
let val: Value = lua.from_value(v)?;
lua.create_string(j5::to_string(&val).map_err(LuaError::external)?)
lua.create_string(j5::to_string(&v).map_err(LuaError::external)?)
.map(LuaValue::String)
}

Expand Down

0 comments on commit 8d8fb6c

Please sign in to comment.