Skip to content

Commit 159dd6d

Browse files
committed
Unused variant config
1 parent 0b79883 commit 159dd6d

File tree

2 files changed

+5
-70
lines changed

2 files changed

+5
-70
lines changed

rmp-serde/src/config.rs

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,6 @@ impl sealed::SerializerConfig for DefaultConfig {
8383
value.serialize(ser)
8484
}
8585

86-
#[inline]
87-
fn write_variant_ident<S>(
88-
ser: &mut S,
89-
_variant_index: u32,
90-
variant: &'static str,
91-
) -> Result<(), Error>
92-
where
93-
S: UnderlyingWrite,
94-
for<'a> &'a mut S: Serializer<Ok = (), Error = Error>,
95-
{
96-
ser.serialize_str(variant)
97-
}
98-
9986
#[inline(always)]
10087
fn is_human_readable() -> bool {
10188
false
@@ -144,19 +131,6 @@ where
144131
value.serialize(ser)
145132
}
146133

147-
#[inline]
148-
fn write_variant_ident<S>(
149-
ser: &mut S,
150-
variant_index: u32,
151-
variant: &'static str,
152-
) -> Result<(), Error>
153-
where
154-
S: UnderlyingWrite,
155-
for<'a> &'a mut S: Serializer<Ok = (), Error = Error>,
156-
{
157-
C::write_variant_ident(ser, variant_index, variant)
158-
}
159-
160134
#[inline(always)]
161135
fn is_human_readable() -> bool {
162136
C::is_human_readable()
@@ -200,19 +174,6 @@ where
200174
value.serialize(ser)
201175
}
202176

203-
#[inline]
204-
fn write_variant_ident<S>(
205-
ser: &mut S,
206-
variant_index: u32,
207-
variant: &'static str,
208-
) -> Result<(), Error>
209-
where
210-
S: UnderlyingWrite,
211-
for<'a> &'a mut S: Serializer<Ok = (), Error = Error>,
212-
{
213-
C::write_variant_ident(ser, variant_index, variant)
214-
}
215-
216177
#[inline(always)]
217178
fn is_human_readable() -> bool {
218179
C::is_human_readable()
@@ -255,19 +216,6 @@ where
255216
C::write_struct_field(ser, key, value)
256217
}
257218

258-
#[inline]
259-
fn write_variant_ident<S>(
260-
ser: &mut S,
261-
variant_index: u32,
262-
variant: &'static str,
263-
) -> Result<(), Error>
264-
where
265-
S: UnderlyingWrite,
266-
for<'a> &'a mut S: Serializer<Ok = (), Error = Error>,
267-
{
268-
C::write_variant_ident(ser, variant_index, variant)
269-
}
270-
271219
#[inline(always)]
272220
fn is_human_readable() -> bool {
273221
true
@@ -310,19 +258,6 @@ where
310258
C::write_struct_field(ser, key, value)
311259
}
312260

313-
#[inline]
314-
fn write_variant_ident<S>(
315-
ser: &mut S,
316-
variant_index: u32,
317-
variant: &'static str,
318-
) -> Result<(), Error>
319-
where
320-
S: UnderlyingWrite,
321-
for<'a> &'a mut S: Serializer<Ok = (), Error = Error>,
322-
{
323-
C::write_variant_ident(ser, variant_index, variant)
324-
}
325-
326261
#[inline(always)]
327262
fn is_human_readable() -> bool {
328263
false

rmp-serde/src/encode.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ where
591591
fn serialize_unit_variant(self, _name: &str, idx: u32, variant: &'static str) ->
592592
Result<Self::Ok, Self::Error>
593593
{
594-
C::write_variant_ident(self, idx, variant)
594+
self.serialize_str(variant)
595595
}
596596

597597
fn serialize_newtype_struct<T: ?Sized + serde::Serialize>(self, name: &'static str, value: &T) -> Result<(), Self::Error> {
@@ -609,7 +609,7 @@ where
609609
fn serialize_newtype_variant<T: ?Sized + serde::Serialize>(self, _name: &'static str, idx: u32, variant: &'static str, value: &T) -> Result<Self::Ok, Self::Error> {
610610
// encode as a map from variant idx to its attributed data, like: {idx => value}
611611
encode::write_map_len(&mut self.wr, 1)?;
612-
C::write_variant_ident(self, idx, variant)?;
612+
self.serialize_str(variant)?;
613613
value.serialize(self)
614614
}
615615

@@ -637,7 +637,7 @@ where
637637
{
638638
// encode as a map from variant idx to a sequence of its attributed data, like: {idx => [v1,...,vN]}
639639
encode::write_map_len(&mut self.wr, 1)?;
640-
C::write_variant_ident(self, idx, variant)?;
640+
self.serialize_str(variant)?;
641641
self.serialize_tuple(len)
642642
}
643643

@@ -652,12 +652,12 @@ where
652652
self.compound()
653653
}
654654

655-
fn serialize_struct_variant(self, name: &'static str, id: u32, variant: &'static str, len: usize) ->
655+
fn serialize_struct_variant(self, name: &'static str, _: u32, variant: &'static str, len: usize) ->
656656
Result<Self::SerializeStructVariant, Error>
657657
{
658658
// encode as a map from variant idx to a sequence of its attributed data, like: {idx => [v1,...,vN]}
659659
encode::write_map_len(&mut self.wr, 1)?;
660-
C::write_variant_ident(self, id, variant)?;
660+
self.serialize_str(variant)?;
661661
self.serialize_struct(name, len)
662662
}
663663
}

0 commit comments

Comments
 (0)