mirror of
https://github.com/actix/actix-web.git
synced 2025-01-02 05:18:44 +00:00
clippy warnings
This commit is contained in:
parent
05a43a855e
commit
8058d15624
4 changed files with 19 additions and 14 deletions
|
@ -1007,22 +1007,22 @@ impl Protocol {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_http(&self) -> bool {
|
fn is_http(self) -> bool {
|
||||||
match *self {
|
match self {
|
||||||
Protocol::Https | Protocol::Http => true,
|
Protocol::Https | Protocol::Http => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_secure(&self) -> bool {
|
fn is_secure(self) -> bool {
|
||||||
match *self {
|
match self {
|
||||||
Protocol::Https | Protocol::Wss => true,
|
Protocol::Https | Protocol::Wss => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn port(&self) -> u16 {
|
fn port(self) -> u16 {
|
||||||
match *self {
|
match self {
|
||||||
Protocol::Http | Protocol::Ws => 80,
|
Protocol::Http | Protocol::Ws => 80,
|
||||||
Protocol::Https | Protocol::Wss => 443,
|
Protocol::Https | Protocol::Wss => 443,
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,8 +129,8 @@ pub enum ContentEncoding {
|
||||||
impl ContentEncoding {
|
impl ContentEncoding {
|
||||||
#[inline]
|
#[inline]
|
||||||
/// Is the content compressed?
|
/// Is the content compressed?
|
||||||
pub fn is_compression(&self) -> bool {
|
pub fn is_compression(self) -> bool {
|
||||||
match *self {
|
match self {
|
||||||
ContentEncoding::Identity | ContentEncoding::Auto => false,
|
ContentEncoding::Identity | ContentEncoding::Auto => false,
|
||||||
_ => true,
|
_ => true,
|
||||||
}
|
}
|
||||||
|
@ -138,8 +138,8 @@ impl ContentEncoding {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
/// Convert content encoding to string
|
/// Convert content encoding to string
|
||||||
pub fn as_str(&self) -> &'static str {
|
pub fn as_str(self) -> &'static str {
|
||||||
match *self {
|
match self {
|
||||||
#[cfg(feature = "brotli")]
|
#[cfg(feature = "brotli")]
|
||||||
ContentEncoding::Br => "br",
|
ContentEncoding::Br => "br",
|
||||||
#[cfg(feature = "flate2")]
|
#[cfg(feature = "flate2")]
|
||||||
|
@ -152,8 +152,8 @@ impl ContentEncoding {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
/// default quality value
|
/// default quality value
|
||||||
pub fn quality(&self) -> f64 {
|
pub fn quality(self) -> f64 {
|
||||||
match *self {
|
match self {
|
||||||
#[cfg(feature = "brotli")]
|
#[cfg(feature = "brotli")]
|
||||||
ContentEncoding::Br => 1.1,
|
ContentEncoding::Br => 1.1,
|
||||||
#[cfg(feature = "flate2")]
|
#[cfg(feature = "flate2")]
|
||||||
|
|
|
@ -130,7 +130,6 @@ impl H1Decoder {
|
||||||
if let Ok(name) =
|
if let Ok(name) =
|
||||||
HeaderName::from_bytes(&slice[idx.name.0..idx.name.1])
|
HeaderName::from_bytes(&slice[idx.name.0..idx.name.1])
|
||||||
{
|
{
|
||||||
has_upgrade = has_upgrade || name == header::UPGRADE;
|
|
||||||
// Unsafe: httparse check header value for valid utf-8
|
// Unsafe: httparse check header value for valid utf-8
|
||||||
let value = unsafe {
|
let value = unsafe {
|
||||||
HeaderValue::from_shared_unchecked(
|
HeaderValue::from_shared_unchecked(
|
||||||
|
@ -176,6 +175,9 @@ impl H1Decoder {
|
||||||
};
|
};
|
||||||
inner.flags.get_mut().set(MessageFlags::KEEPALIVE, ka);
|
inner.flags.get_mut().set(MessageFlags::KEEPALIVE, ka);
|
||||||
}
|
}
|
||||||
|
header::UPGRADE => {
|
||||||
|
has_upgrade = true;
|
||||||
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -204,9 +204,12 @@ impl<T: AsyncWrite, H: 'static> Writer for H1Writer<T, H> {
|
||||||
ResponseLength::None => (),
|
ResponseLength::None => (),
|
||||||
_ => continue,
|
_ => continue,
|
||||||
},
|
},
|
||||||
|
DATE => {
|
||||||
|
has_date = true;
|
||||||
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
has_date = has_date || key == DATE;
|
|
||||||
let v = value.as_ref();
|
let v = value.as_ref();
|
||||||
let k = key.as_str().as_bytes();
|
let k = key.as_str().as_bytes();
|
||||||
let len = k.len() + v.len() + 4;
|
let len = k.len() + v.len() + 4;
|
||||||
|
|
Loading…
Reference in a new issue