diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index cc34e2bc..1c0d467b 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,8 @@ -## PR Type -What kind of change does this PR make? + + +## PR Type + INSERT_PR_TYPE diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 7529c849..688db6ce 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -8,7 +8,7 @@ jobs: fail-fast: false matrix: version: - - 1.41.1 # MSRV + - 1.42.0 # MSRV - stable - nightly diff --git a/CHANGES.md b/CHANGES.md index 5783da75..d80e8794 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ using `App::data`. [#1610] * `web::Path` now has a public representation: `web::Path(pub T)` that enables destructuring. [#1594] +* MSRV is now 1.42.0. ### Fixed * Memory leak of app data in pooled requests. [#1609] diff --git a/README.md b/README.md index 4f6a1619..a42a1a6f 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![crates.io](https://meritbadge.herokuapp.com/actix-web)](https://crates.io/crates/actix-web) [![Documentation](https://docs.rs/actix-web/badge.svg)](https://docs.rs/actix-web) -[![Version](https://img.shields.io/badge/rustc-1.41+-lightgray.svg)](https://blog.rust-lang.org/2020/02/27/Rust-1.41.1.html) +[![Version](https://img.shields.io/badge/rustc-1.42+-ab6000.svg)](https://blog.rust-lang.org/2020/03/12/Rust-1.42.html) ![License](https://img.shields.io/crates/l/actix-web.svg)
[![Build Status](https://travis-ci.org/actix/actix-web.svg?branch=master)](https://travis-ci.org/actix/actix-web) @@ -32,7 +32,7 @@ * Middlewares ([Logger, Session, CORS, etc](https://actix.rs/docs/middleware/)) * Includes an async [HTTP client](https://actix.rs/actix-web/actix_web/client/index.html) * Supports [Actix actor framework](https://github.com/actix/actix) -* Runs on stable Rust 1.41+ +* Runs on stable Rust 1.42+ ## Documentation diff --git a/actix-http/src/body.rs b/actix-http/src/body.rs index 0b01aa8c..137f462a 100644 --- a/actix-http/src/body.rs +++ b/actix-http/src/body.rs @@ -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, diff --git a/actix-http/src/client/h2proto.rs b/actix-http/src/client/h2proto.rs index 48ab9fe4..7d1d3dc5 100644 --- a/actix-http/src/client/h2proto.rs +++ b/actix-http/src/client/h2proto.rs @@ -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(); diff --git a/actix-http/src/h1/decoder.rs b/actix-http/src/h1/decoder.rs index c9d3edf3..89a18aea 100644 --- a/actix-http/src/h1/decoder.rs +++ b/actix-http/src/h1/decoder.rs @@ -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) } } diff --git a/actix-http/src/h1/dispatcher.rs b/actix-http/src/h1/dispatcher.rs index 51f107ef..a9ab2988 100644 --- a/actix-http/src/h1/dispatcher.rs +++ b/actix-http/src/h1/dispatcher.rs @@ -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, } } diff --git a/actix-http/src/header/common/content_disposition.rs b/actix-http/src/header/common/content_disposition.rs index d6593390..051dcfe8 100644 --- a/actix-http/src/header/common/content_disposition.rs +++ b/actix-http/src/header/common/content_disposition.rs @@ -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. diff --git a/actix-http/src/header/mod.rs b/actix-http/src/header/mod.rs index 0db26ceb..46fb31a6 100644 --- a/actix-http/src/header/mod.rs +++ b/actix-http/src/header/mod.rs @@ -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] diff --git a/actix-http/src/ws/frame.rs b/actix-http/src/ws/frame.rs index 8f7004f1..0598a9b4 100644 --- a/actix-http/src/ws/frame.rs +++ b/actix-http/src/ws/frame.rs @@ -229,10 +229,7 @@ mod tests { fn is_none( frm: &Result)>, ProtocolError>, ) -> bool { - match *frm { - Ok(None) => true, - _ => false, - } + matches!(*frm, Ok(None)) } fn extract( diff --git a/awc/src/response.rs b/awc/src/response.rs index ffc8c540..d1490cb9 100644 --- a/awc/src/response.rs +++ b/awc/src/response.rs @@ -402,14 +402,9 @@ mod tests { fn json_eq(err: JsonPayloadError, other: JsonPayloadError) -> bool { match err { - JsonPayloadError::Payload(PayloadError::Overflow) => match other { - JsonPayloadError::Payload(PayloadError::Overflow) => true, - _ => false, - }, - JsonPayloadError::ContentType => match other { - JsonPayloadError::ContentType => true, - _ => false, - }, + JsonPayloadError::Payload(PayloadError::Overflow) => + matches!(other, JsonPayloadError::Payload(PayloadError::Overflow)), + JsonPayloadError::ContentType => matches!(other, JsonPayloadError::ContentType), _ => false, } } diff --git a/rust-toolchain b/rust-toolchain index f86fb9cb..a50908ca 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.41.1 +1.42.0 diff --git a/src/types/form.rs b/src/types/form.rs index c10ed464..d7db595c 100644 --- a/src/types/form.rs +++ b/src/types/form.rs @@ -407,18 +407,9 @@ mod tests { fn eq(err: UrlencodedError, other: UrlencodedError) -> bool { match err { - UrlencodedError::Overflow { .. } => match other { - UrlencodedError::Overflow { .. } => true, - _ => false, - }, - UrlencodedError::UnknownLength => match other { - UrlencodedError::UnknownLength => true, - _ => false, - }, - UrlencodedError::ContentType => match other { - UrlencodedError::ContentType => true, - _ => false, - }, + UrlencodedError::Overflow { .. } => matches!(other, UrlencodedError::Overflow { .. }), + UrlencodedError::UnknownLength => matches!(other, UrlencodedError::UnknownLength), + UrlencodedError::ContentType => matches!(other, UrlencodedError::ContentType), _ => false, } } diff --git a/src/types/json.rs b/src/types/json.rs index 6de9e0d8..1665ca95 100644 --- a/src/types/json.rs +++ b/src/types/json.rs @@ -433,14 +433,8 @@ mod tests { fn json_eq(err: JsonPayloadError, other: JsonPayloadError) -> bool { match err { - JsonPayloadError::Overflow => match other { - JsonPayloadError::Overflow => true, - _ => false, - }, - JsonPayloadError::ContentType => match other { - JsonPayloadError::ContentType => true, - _ => false, - }, + JsonPayloadError::Overflow => matches!(other, JsonPayloadError::Overflow), + JsonPayloadError::ContentType => matches!(other, JsonPayloadError::ContentType), _ => false, } }