1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-07-01 00:44:26 +02:00
This commit is contained in:
Rob Ede
2021-08-13 18:49:58 +01:00
parent a0c0bff944
commit 5f412c67db
12 changed files with 19 additions and 18 deletions

View File

@ -457,7 +457,7 @@ impl Header for ContentDisposition {
fn parse<T: crate::HttpMessage>(msg: &T) -> Result<Self, crate::error::ParseError> {
if let Some(h) = msg.headers().get(&Self::name()) {
Self::from_raw(&h)
Self::from_raw(h)
} else {
Err(crate::error::ParseError::Header)
}

View File

@ -553,7 +553,7 @@ impl FormatText {
*self = FormatText::Str(s.to_string());
}
FormatText::RemoteAddr => {
let s = if let Some(ref peer) = req.connection_info().remote_addr() {
let s = if let Some(peer) = req.connection_info().remote_addr() {
FormatText::Str((*peer).to_string())
} else {
FormatText::Str("-".to_string())

View File

@ -184,7 +184,7 @@ impl HttpRequest {
U: IntoIterator<Item = I>,
I: AsRef<str>,
{
self.resource_map().url_for(&self, name, elements)
self.resource_map().url_for(self, name, elements)
}
/// Generate url for named resource
@ -199,7 +199,7 @@ impl HttpRequest {
#[inline]
/// Get a reference to a `ResourceMap` of current application.
pub fn resource_map(&self) -> &ResourceMap {
&self.app_state().rmap()
self.app_state().rmap()
}
/// Peer socket address.

View File

@ -117,7 +117,7 @@ impl ServiceRequest {
/// This method returns reference to the request head
#[inline]
pub fn head(&self) -> &RequestHead {
&self.req.head()
self.req.head()
}
/// This method returns reference to the request head

View File

@ -253,7 +253,7 @@ where
Ok(bytes) => {
let fallback = bytes.clone();
let left =
L::from_request(&this.req, &mut payload_from_bytes(bytes));
L::from_request(this.req, &mut payload_from_bytes(bytes));
EitherExtractState::Left { left, fallback }
}
Err(err) => break Err(EitherExtractError::Bytes(err)),
@ -265,7 +265,7 @@ where
Ok(extracted) => break Ok(Either::Left(extracted)),
Err(left_err) => {
let right = R::from_request(
&this.req,
this.req,
&mut payload_from_bytes(mem::take(fallback)),
);
EitherExtractState::Right {

View File

@ -425,7 +425,7 @@ where
}
}
None => {
let json = serde_json::from_slice::<T>(&buf)
let json = serde_json::from_slice::<T>(buf)
.map_err(JsonPayloadError::Deserialize)?;
return Poll::Ready(Ok(json));
}