remove Clone impl for Message.

This commit is contained in:
fakeshadow 2021-01-19 03:16:50 +08:00
parent 1bdc6dc4f6
commit 5f22efffc4
2 changed files with 5 additions and 7 deletions

View File

@ -348,12 +348,6 @@ pub struct Message<T: Head> {
head: Rc<T>, head: Rc<T>,
} }
impl<T: Head> Clone for Message<T> {
fn clone(&self) -> Self {
panic!("Message<T> type should not be Clone.")
}
}
impl<T: Head> Message<T> { impl<T: Head> Message<T> {
/// Get new message from the pool of objects /// Get new message from the pool of objects
pub fn new() -> Self { pub fn new() -> Self {

View File

@ -722,9 +722,11 @@ async fn test_client_cookie_handling() {
async fn client_unread_response() { async fn client_unread_response() {
let addr = test::unused_addr(); let addr = test::unused_addr();
let (tx, rx) = std::sync::mpsc::sync_channel(1);
std::thread::spawn(move || { std::thread::spawn(move || {
let lst = std::net::TcpListener::bind(addr).unwrap(); let lst = std::net::TcpListener::bind(addr).unwrap();
tx.send(()).unwrap();
for stream in lst.incoming() { for stream in lst.incoming() {
let mut stream = stream.unwrap(); let mut stream = stream.unwrap();
let mut b = [0; 1000]; let mut b = [0; 1000];
@ -738,6 +740,8 @@ async fn client_unread_response() {
} }
}); });
rx.recv().unwrap();
// client request // client request
let req = awc::Client::new().get(format!("http://{}/", addr).as_str()); let req = awc::Client::new().get(format!("http://{}/", addr).as_str());
let mut res = req.send().await.unwrap(); let mut res = req.send().await.unwrap();