Use more consistent error messages for bad flattening

This commit is contained in:
Armin Ronacher committed 2018-03-18 23:46:28 +01:00
1 parent c5a3128492
commit 7cf184624a
3 files changed
+38 -6

No files matched your search

+1 -1
View File
@@ -2095,7 +2095,7 @@ impl<'a, 'de, E> Deserializer<'de> for FlatMapDeserializer<'a, 'de, E>
where
V: Visitor<'de>,
{
Err(Error::custom("can only flatten structs, maps and struct enum variants"))
Err(Error::custom("can only flatten structs and maps"))
}
fn deserialize_enum<V>(
+1 -3
View File
@@ -1043,9 +1043,7 @@ where
M: SerializeMap + 'a
{
fn bad_type(self, what: Unsupported) -> M::Error {
ser::Error::custom(format_args!(
"cannot flatten serialize {} values", what
))
ser::Error::custom(format_args!("can only flatten structs and maps (got {})", what))
}
}