From 0dc609fc300580fc87857695cf71b3dcdbcd7308 Mon Sep 17 00:00:00 2001 From: Martin Algesten Date: Sun, 14 Mar 2021 11:20:23 +0100 Subject: [PATCH] Ensure Error and Response implement Send+Sync This is to ensure we don't accidentally introduce breaking changes with respects to Send and Sync. --- src/error.rs | 8 +++----- src/response.rs | 6 ++++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/error.rs b/src/error.rs index a01420c..881a04c 100644 --- a/src/error.rs +++ b/src/error.rs @@ -410,10 +410,8 @@ mod tests { } #[test] - fn error_is_send_and_sync() { - fn takes_send(_: impl Send) {} - fn takes_sync(_: impl Sync) {} - takes_send(crate::error::ErrorKind::InvalidUrl.new()); - takes_sync(crate::error::ErrorKind::InvalidUrl.new()); + fn error_implements_send_and_sync() { + let _error: Box = Box::new(Error::new(ErrorKind::Io, None)); + let _error: Box = Box::new(Error::new(ErrorKind::Io, None)); } } diff --git a/src/response.rs b/src/response.rs index 97b6c54..e477aad 100644 --- a/src/response.rs +++ b/src/response.rs @@ -833,4 +833,10 @@ mod tests { let hist: Vec<&str> = response2.history.iter().map(|r| &**r).collect(); assert_eq!(hist, ["http://1.example.com/", "http://2.example.com/"]) } + + #[test] + fn response_implements_send_and_sync() { + let _response: Box = Box::new(Response::new(302, "Found", "").unwrap()); + let _response: Box = Box::new(Response::new(302, "Found", "").unwrap()); + } }