1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 06:39:22 +02:00

bump MSRV to 1.42 (#1616)

This commit is contained in:
Rob Ede
2020-07-21 08:40:30 +01:00
committed by GitHub
parent f8d5ad6b53
commit 0ec335a39c
15 changed files with 29 additions and 82 deletions

View File

@ -192,14 +192,8 @@ impl MessageBody for Body {
impl PartialEq for Body {
fn eq(&self, other: &Body) -> bool {
match *self {
Body::None => match *other {
Body::None => true,
_ => false,
},
Body::Empty => match *other {
Body::Empty => true,
_ => false,
},
Body::None => matches!(*other, Body::None),
Body::Empty => matches!(*other, Body::Empty),
Body::Bytes(ref b) => match *other {
Body::Bytes(ref b2) => b == b2,
_ => false,

View File

@ -37,10 +37,7 @@ where
trace!("Sending client request: {:?} {:?}", head, body.size());
let head_req = head.as_ref().method == Method::HEAD;
let length = body.size();
let eof = match length {
BodySize::None | BodySize::Empty | BodySize::Sized(0) => true,
_ => false,
};
let eof = matches!(length, BodySize::None | BodySize::Empty | BodySize::Sized(0));
let mut req = Request::new(());
*req.uri_mut() = head.as_ref().uri.clone();

View File

@ -655,10 +655,7 @@ mod tests {
}
fn is_unhandled(&self) -> bool {
match self {
PayloadType::Stream(_) => true,
_ => false,
}
matches!(self, PayloadType::Stream(_))
}
}
@ -670,10 +667,7 @@ mod tests {
}
}
fn eof(&self) -> bool {
match *self {
PayloadItem::Eof => true,
_ => false,
}
matches!(*self, PayloadItem::Eof)
}
}

View File

@ -156,14 +156,8 @@ enum PollResponse {
impl PartialEq for PollResponse {
fn eq(&self, other: &PollResponse) -> bool {
match self {
PollResponse::DrainWriteBuf => match other {
PollResponse::DrainWriteBuf => true,
_ => false,
},
PollResponse::DoNothing => match other {
PollResponse::DoNothing => true,
_ => false,
},
PollResponse::DrainWriteBuf => matches!(other, PollResponse::DrainWriteBuf),
PollResponse::DoNothing => matches!(other, PollResponse::DoNothing),
_ => false,
}
}

View File

@ -387,26 +387,17 @@ impl ContentDisposition {
/// Returns `true` if it is [`Inline`](DispositionType::Inline).
pub fn is_inline(&self) -> bool {
match self.disposition {
DispositionType::Inline => true,
_ => false,
}
matches!(self.disposition, DispositionType::Inline)
}
/// Returns `true` if it is [`Attachment`](DispositionType::Attachment).
pub fn is_attachment(&self) -> bool {
match self.disposition {
DispositionType::Attachment => true,
_ => false,
}
matches!(self.disposition, DispositionType::Attachment)
}
/// Returns `true` if it is [`FormData`](DispositionType::FormData).
pub fn is_form_data(&self) -> bool {
match self.disposition {
DispositionType::FormData => true,
_ => false,
}
matches!(self.disposition, DispositionType::FormData)
}
/// Returns `true` if it is [`Ext`](DispositionType::Ext) and the `disp_type` matches.

View File

@ -148,10 +148,7 @@ impl ContentEncoding {
#[inline]
/// Is the content compressed?
pub fn is_compression(self) -> bool {
match self {
ContentEncoding::Identity | ContentEncoding::Auto => false,
_ => true,
}
matches!(self, ContentEncoding::Identity | ContentEncoding::Auto)
}
#[inline]

View File

@ -229,10 +229,7 @@ mod tests {
fn is_none(
frm: &Result<Option<(bool, OpCode, Option<BytesMut>)>, ProtocolError>,
) -> bool {
match *frm {
Ok(None) => true,
_ => false,
}
matches!(*frm, Ok(None))
}
fn extract(