diff --git a/src/error.rs b/src/error.rs index c558ebbac..12fca8b9c 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 a46ae5702..f1fdb49f7 100644 --- a/src/into_url.rs +++ b/src/into_url.rs @@ -84,13 +84,14 @@ if_hyper! { #[cfg(test)] mod tests { use super::*; + use std::error::Error; #[test] fn into_url_file_scheme() { let err = "file:///etc/hosts".into_url().unwrap_err(); assert_eq!( - err.to_string(), - "builder error for url (file:///etc/hosts): URL scheme is not allowed" + err.source().unwrap().to_string(), + "URL scheme is not allowed" ); } @@ -98,8 +99,8 @@ mod tests { fn into_url_blob_scheme() { let err = "blob:https://example.com".into_url().unwrap_err(); assert_eq!( - err.to_string(), - "builder error for url (blob:https://example.com): URL scheme is not allowed" + err.source().unwrap().to_string(), + "URL scheme is not allowed" ); }