1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-06-11 01:39:33 +00:00

fix warnings

This commit is contained in:
Nikolay Kim 2019-03-06 21:12:35 -08:00
parent b689bb9260
commit e25483a0d5
6 changed files with 5 additions and 31 deletions

View file

@ -970,23 +970,13 @@ where
#[cfg(feature = "fail")]
mod failure_integration {
use super::*;
use failure::{self, Fail};
/// Compatibility for `failure::Error`
impl<T> ResponseError for failure::Compat<T>
where
T: fmt::Display + fmt::Debug + Sync + Send + 'static,
{
impl ResponseError for failure::Error {
fn error_response(&self) -> Response {
Response::new(StatusCode::INTERNAL_SERVER_ERROR)
}
}
impl From<failure::Error> for Error {
fn from(err: failure::Error) -> Error {
err.compat().into()
}
}
}
#[cfg(test)]

View file

@ -27,7 +27,7 @@ fn split_once(haystack: &str, needle: char) -> (&str, &str) {
/// first part and the left of the last part.
fn split_once_and_trim(haystack: &str, needle: char) -> (&str, &str) {
let (first, last) = split_once(haystack, needle);
(first.trim_right(), last.trim_left())
(first.trim_end(), last.trim_start())
}
/// The implied disposition of the content of the HTTP body.
@ -324,7 +324,7 @@ impl ContentDisposition {
}
}
left = &left[end.ok_or(crate::error::ParseError::Header)? + 1..];
left = split_once(left, ';').1.trim_left();
left = split_once(left, ';').1.trim_start();
// In fact, it should not be Err if the above code is correct.
String::from_utf8(quoted_string)
.map_err(|_| crate::error::ParseError::Header)?

View file

@ -58,7 +58,7 @@ impl<T: fmt::Display> fmt::Display for QualityItem<T> {
match self.quality.0 {
1000 => Ok(()),
0 => f.write_str("; q=0"),
x => write!(f, "; q=0.{}", format!("{:03}", x).trim_right_matches('0')),
x => write!(f, "; q=0.{}", format!("{:03}", x).trim_end_matches('0')),
}
}
}

View file

@ -103,7 +103,7 @@ impl<P> Request<P> {
}
/// Mutable reference to the message's headers.
fn headers_mut(&mut self) -> &mut HeaderMap {
pub fn headers_mut(&mut self) -> &mut HeaderMap {
&mut self.head_mut().headers
}

View file

@ -46,7 +46,6 @@ struct Inner {
headers: HeaderMap,
_cookies: Option<Vec<Cookie<'static>>>,
payload: Option<Payload>,
prefix: u16,
}
impl Default for TestRequest {
@ -58,7 +57,6 @@ impl Default for TestRequest {
headers: HeaderMap::new(),
_cookies: None,
payload: None,
prefix: 0,
}))
}
}

View file

@ -25,20 +25,6 @@ impl Protocol {
}
}
fn is_http(self) -> bool {
match self {
Protocol::Https | Protocol::Http => true,
_ => false,
}
}
fn is_secure(self) -> bool {
match self {
Protocol::Https | Protocol::Wss => true,
_ => false,
}
}
fn port(self) -> u16 {
match self {
Protocol::Http | Protocol::Ws => 80,