mirror of
https://github.com/fafhrd91/actix-web
synced 2025-07-01 16:55:08 +02:00
clippy
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
@ -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())
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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));
|
||||
}
|
||||
|
Reference in New Issue
Block a user