diff --git a/rustler/src/serde/ser.rs b/rustler/src/serde/ser.rs index 0734f263..9f1b7515 100644 --- a/rustler/src/serde/ser.rs +++ b/rustler/src/serde/ser.rs @@ -80,7 +80,7 @@ impl<'a> ser::Serializer for Serializer<'a> { #[inline] fn serialize_i16(self, v: i16) -> Result { - v.serialize(self) + (v as i32).serialize(self) } #[inline] diff --git a/rustler_tests/test/serde_rustler_tests_test.exs b/rustler_tests/test/serde_rustler_tests_test.exs index d096ca40..a8d022af 100644 --- a/rustler_tests/test/serde_rustler_tests_test.exs +++ b/rustler_tests/test/serde_rustler_tests_test.exs @@ -223,11 +223,11 @@ defmodule SerdeRustlerTests.NifTest do describe "Unit Types:" do test "unit", ctx do - run_tests("unit", nil, ctx) + run_tests("unit", {}, ctx) end test "unit struct", ctx do - run_tests("unit struct", nil, ctx) + run_tests("unit struct", {}, ctx) end test "unit variant", ctx do