Repository: awslabs/aws-lambda-rust-runtime (language: rust)

Issue:
Migrate to Rust 2021 edition
There were some issues migrating to 2021 edition. I think we should address the problems and move all the crates to the 2021 editions.


Discussion / hints:
Is there any compelling reason to move to 2021 at the moment?

Currently, the AWS SDK is on 2018 with a MSRV of 1.54.0, so I'd personally prefer to stay there for compatibility reason.
https://github.com/awslabs/smithy-rs/pull/1388

Fix patch:
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 570224eb..a39c9d55 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -12,7 +12,7 @@ jobs:
           - ubuntu-latest
           - macOS-latest
         rust:
-          - "1.54.0" # Current MSRV
+          - "1.58.0" # Current MSRV
           - stable
           - beta
           - nightly
@@ -22,24 +22,6 @@ jobs:
         include:
           - rust: nightly
             allow_failure: true
-        # exclude:
-        #   - os: macOS-latest
-        #     target: x86_64-unknown-linux-musl
-        #   - os: ubuntu-latest
-        #     rust: 1.40.0
-        #     target: x86_64-unknown-linux-musl
-        #   - os: ubuntu-latest
-        #     rust: beta
-        #     target: x86_64-unknown-linux-musl
-        #   - os: ubuntu-latest
-        #     rust: nightly
-        #     target: x86_64-unknown-linux-musl
-        #   - os: macOS-latest
-        #     rust: 1.40.0
-        #   - os: macOS-latest
-        #     rust: beta
-        #   - os: macOS-latest
-        #     rust: nightly
     env:
       RUST_BACKTRACE: 1
     steps:
diff --git a/README.md b/README.md
index 46f87e5c..a18d62a7 100644
--- a/README.md
+++ b/README.md
@@ -398,7 +398,7 @@ This will make your function compile much faster.
 
 ## Supported Rust Versions (MSRV)
 
-The AWS Lambda Rust Runtime requires a minimum of Rust 1.54, and is not guaranteed to build on compiler versions earlier than that.
+The AWS Lambda Rust Runtime requires a minimum of Rust 1.58, and is not guaranteed to build on compiler versions earlier than that.
 
 ## Security
 
diff --git a/lambda-extension/Cargo.toml b/lambda-extension/Cargo.toml
index d7b0102a..bd8ef428 100644
--- a/lambda-extension/Cargo.toml
+++ b/lambda-extension/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 name = "lambda-extension"
 version = "0.5.0"
-edition = "2018"
+edition = "2021"
 authors = ["David Calavera <david.calavera@gmail.com>"]
 description = "AWS Lambda Extension API"
 license = "Apache-2.0"
diff --git a/lambda-http/Cargo.toml b/lambda-http/Cargo.toml
index 92955045..be580699 100644
--- a/lambda-http/Cargo.toml
+++ b/lambda-http/Cargo.toml
@@ -2,7 +2,7 @@
 name = "lambda_http"
 version = "0.5.2"
 authors = ["Doug Tangren"]
-edition = "2018"
+edition = "2021"
 description = "Application Load Balancer and API Gateway event types for AWS Lambda"
 keywords = ["AWS", "Lambda", "APIGateway", "ALB", "API"]
 license = "Apache-2.0"
diff --git a/lambda-http/src/lib.rs b/lambda-http/src/lib.rs
index dd02ab4d..3581002f 100644
--- a/lambda-http/src/lib.rs
+++ b/lambda-http/src/lib.rs
@@ -1,4 +1,4 @@
-#![warn(missing_docs)]
+#![warn(missing_docs, rust_2018_idioms)]
 //#![deny(warnings)]
 //! Enriches the `lambda` crate with [`http`](https://github.com/hyperium/http)
 //! types targeting AWS [ALB](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/introduction.html), [API Gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/welcome.html) REST and HTTP API lambda integrations.
@@ -104,7 +104,7 @@ where
 {
     type Output = Result<LambdaResponse, E>;
 
-    fn poll(mut self: Pin<&mut Self>, cx: &mut TaskContext) -> Poll<Self::Output> {
+    fn poll(mut self: Pin<&mut Self>, cx: &mut TaskContext<'_>) -> Poll<Self::Output> {
         match *self {
             TransformResponse::Request(ref mut origin, ref mut request) => match request.as_mut().poll(cx) {
                 Poll::Ready(Ok(resp)) => {
diff --git a/lambda-runtime-api-client/Cargo.toml b/lambda-runtime-api-client/Cargo.toml
index 8a8a29b2..7515b734 100644
--- a/lambda-runtime-api-client/Cargo.toml
+++ b/lambda-runtime-api-client/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 name = "lambda_runtime_api_client"
 version = "0.5.0"
-edition = "2018"
+edition = "2021"
 authors = ["David Calavera <david.calavera@gmail.com>"]
 description = "AWS Lambda Runtime interaction API"
 license = "Apache-2.0"
diff --git a/lambda-runtime/Cargo.toml b/lambda-runtime/Cargo.toml
index 1e3d2d6e..0289920d 100644
--- a/lambda-runtime/Cargo.toml
+++ b/lambda-runtime/Cargo.toml
@@ -3,7 +3,7 @@ name = "lambda_runtime"
 version = "0.5.1"
 authors = ["David Barsky <dbarsky@amazon.com>"]
 description = "AWS Lambda Runtime"
-edition = "2018"
+edition = "2021"
 license = "Apache-2.0"
 repository = "https://github.com/awslabs/aws-lambda-rust-runtime"
 categories = ["web-programming::http-server"]


Test patch: