From ee6164788b16d4631d41800dabfa7d88d92fbac9 Mon Sep 17 00:00:00 2001 From: Justin Maillet Date: Sun, 16 Jun 2024 23:01:38 -0300 Subject: [PATCH] Fix #861 serde::Deserialize impl for Url prints confusing error message --- url/src/lib.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/url/src/lib.rs b/url/src/lib.rs index 5e2e5072..76c464f9 100644 --- a/url/src/lib.rs +++ b/url/src/lib.rs @@ -2813,9 +2813,8 @@ impl<'de> serde::Deserialize<'de> for Url { where E: Error, { - Url::parse(s).map_err(|err| { - let err_s = format!("{}", err); - Error::invalid_value(Unexpected::Str(s), &err_s.as_str()) + Url::parse(s).map_err(|_| { + Error::invalid_value(Unexpected::Str(s), &self) }) } }