Skip to content

Commit 5a968bc

Browse files
committed
tests/util/response: Derive Deref for Response
1 parent a4067c4 commit 5a968bc

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/tests/util/response.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,21 @@ use bytes::Bytes;
33
use googletest::prelude::*;
44
use serde_json::Value;
55
use std::marker::PhantomData;
6-
use std::ops::Deref;
76
use std::str::from_utf8;
87

98
use crate::rate_limiter::LimitedAction;
9+
use derive_more::Deref;
1010
use http::{header, StatusCode};
1111

1212
/// A type providing helper methods for working with responses
13+
#[derive(Deref)]
1314
#[must_use]
1415
pub struct Response<T> {
16+
#[deref]
1517
response: hyper::Response<Bytes>,
1618
return_type: PhantomData<T>,
1719
}
1820

19-
impl Deref for Response<()> {
20-
type Target = hyper::Response<Bytes>;
21-
22-
fn deref(&self) -> &Self::Target {
23-
&self.response
24-
}
25-
}
26-
2721
impl<T> Response<T>
2822
where
2923
for<'de> T: serde::Deserialize<'de>,

0 commit comments

Comments
 (0)