From 517f9da761da1ac91474a86725513e14ed07d506 Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Fri, 22 Mar 2024 08:19:58 -0400 Subject: [PATCH] fix: Display for Error shouldn't include source --- src/error.rs | 4 ---- src/into_url.rs | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/error.rs b/src/error.rs index c558ebbac9..12fca8b9c4 100644 --- a/src/error.rs +++ b/src/error.rs @@ -206,10 +206,6 @@ impl fmt::Display for Error { write!(f, " for url ({url})")?; } - if let Some(e) = &self.inner.source { - write!(f, ": {e}")?; - } - Ok(()) } } diff --git a/src/into_url.rs b/src/into_url.rs index a46ae57021..d463e04ba9 100644 --- a/src/into_url.rs +++ b/src/into_url.rs @@ -89,7 +89,7 @@ mod tests { fn into_url_file_scheme() { let err = "file:///etc/hosts".into_url().unwrap_err(); assert_eq!( - err.to_string(), + err.source().unwrap().to_string(), "builder error for url (file:///etc/hosts): URL scheme is not allowed" ); } @@ -98,7 +98,7 @@ mod tests { fn into_url_blob_scheme() { let err = "blob:https://example.com".into_url().unwrap_err(); assert_eq!( - err.to_string(), + err.source().unwrap().to_string(), "builder error for url (blob:https://example.com): URL scheme is not allowed" ); }