mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-30 10:57:56 +00:00
Use more consistent error messages for bad flattening
This commit is contained in:
@@ -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>(
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user