From d4d22e43193011ca7c77a03ff45eb0c675019bf1 Mon Sep 17 00:00:00 2001 From: David Calavera Date: Fri, 12 Aug 2022 21:44:57 -0700 Subject: [PATCH] Fix clippy errors. Signed-off-by: David Calavera --- examples/basic-error-handling/src/main.rs | 2 +- lambda-extension/Cargo.toml | 2 +- lambda-http/Cargo.toml | 2 +- lambda-http/src/ext.rs | 10 +++++----- lambda-http/src/request.rs | 2 +- lambda-runtime-api-client/Cargo.toml | 2 +- lambda-runtime/Cargo.toml | 3 +-- lambda-runtime/src/lib.rs | 2 +- lambda-runtime/src/requests.rs | 4 ++-- lambda-runtime/src/types.rs | 22 +++++++++++----------- 10 files changed, 25 insertions(+), 26 deletions(-) diff --git a/examples/basic-error-handling/src/main.rs b/examples/basic-error-handling/src/main.rs index ee721f95..8d274849 100644 --- a/examples/basic-error-handling/src/main.rs +++ b/examples/basic-error-handling/src/main.rs @@ -12,7 +12,7 @@ struct Request { } /// Event types that tell our Lambda what to do do. -#[derive(Deserialize, PartialEq)] +#[derive(Deserialize, Eq, PartialEq)] enum EventType { Response, ExternalError, diff --git a/lambda-extension/Cargo.toml b/lambda-extension/Cargo.toml index bee81196..34d4518a 100644 --- a/lambda-extension/Cargo.toml +++ b/lambda-extension/Cargo.toml @@ -15,7 +15,7 @@ async-stream = "0.3" bytes = "1.0" chrono = { version = "0.4", features = ["serde"] } http = "0.2" -hyper = { version = "0.14", features = ["http1", "client", "server", "stream", "runtime"] } +hyper = { version = "0.14.20", features = ["http1", "client", "server", "stream", "runtime"] } lambda_runtime_api_client = { version = "0.6", path = "../lambda-runtime-api-client" } serde = { version = "1", features = ["derive"] } serde_json = "^1" diff --git a/lambda-http/Cargo.toml b/lambda-http/Cargo.toml index 0f7a53a6..092a29d3 100644 --- a/lambda-http/Cargo.toml +++ b/lambda-http/Cargo.toml @@ -24,7 +24,7 @@ base64 = "0.13.0" bytes = "1" http = "0.2" http-body = "0.4" -hyper = "0.14" +hyper = "0.14.20" lambda_runtime = { path = "../lambda-runtime", version = "0.6" } serde = { version = "^1", features = ["derive"] } serde_json = "^1" diff --git a/lambda-http/src/ext.rs b/lambda-http/src/ext.rs index b53cd851..0cd85982 100644 --- a/lambda-http/src/ext.rs +++ b/lambda-http/src/ext.rs @@ -328,7 +328,7 @@ mod tests { #[test] fn requests_have_form_post_parsable_payloads() { - #[derive(Deserialize, PartialEq, Debug)] + #[derive(Deserialize, Eq, PartialEq, Debug)] struct Payload { foo: String, baz: usize, @@ -349,7 +349,7 @@ mod tests { #[test] fn requests_have_json_parseable_payloads() { - #[derive(Deserialize, PartialEq, Debug)] + #[derive(Deserialize, Eq, PartialEq, Debug)] struct Payload { foo: String, baz: usize, @@ -370,7 +370,7 @@ mod tests { #[test] fn requests_match_form_post_content_type_with_charset() { - #[derive(Deserialize, PartialEq, Debug)] + #[derive(Deserialize, Eq, PartialEq, Debug)] struct Payload { foo: String, baz: usize, @@ -391,7 +391,7 @@ mod tests { #[test] fn requests_match_json_content_type_with_charset() { - #[derive(Deserialize, PartialEq, Debug)] + #[derive(Deserialize, Eq, PartialEq, Debug)] struct Payload { foo: String, baz: usize, @@ -412,7 +412,7 @@ mod tests { #[test] fn requests_omiting_content_types_do_not_support_parseable_payloads() { - #[derive(Deserialize, PartialEq, Debug)] + #[derive(Deserialize, Eq, PartialEq, Debug)] struct Payload { foo: String, baz: usize, diff --git a/lambda-http/src/request.rs b/lambda-http/src/request.rs index 77eb5913..fba1935c 100644 --- a/lambda-http/src/request.rs +++ b/lambda-http/src/request.rs @@ -376,7 +376,7 @@ pub enum RequestContext { } /// Converts LambdaRequest types into `http::Request` types -impl<'a> From for http::Request { +impl From for http::Request { fn from(value: LambdaRequest) -> Self { match value { #[cfg(feature = "apigw_rest")] diff --git a/lambda-runtime-api-client/Cargo.toml b/lambda-runtime-api-client/Cargo.toml index 5cc8c2e8..c3bbd754 100644 --- a/lambda-runtime-api-client/Cargo.toml +++ b/lambda-runtime-api-client/Cargo.toml @@ -12,6 +12,6 @@ readme = "README.md" [dependencies] http = "0.2" -hyper = { version = "0.14", features = ["http1", "client", "stream", "tcp"] } +hyper = { version = "0.14.20", features = ["http1", "client", "stream", "tcp"] } tower-service = "0.3" tokio = { version = "1.0", features = ["io-util"] } diff --git a/lambda-runtime/Cargo.toml b/lambda-runtime/Cargo.toml index 3cfb6f56..44bb4218 100644 --- a/lambda-runtime/Cargo.toml +++ b/lambda-runtime/Cargo.toml @@ -17,7 +17,7 @@ simulated = [] [dependencies] tokio = { version = "1.0", features = ["macros", "io-util", "sync", "rt-multi-thread"] } # Hyper requires the `server` feature to work on nightly -hyper = { version = "0.14", features = ["http1", "client", "stream", "server"] } +hyper = { version = "0.14.20", features = ["http1", "client", "stream", "server"] } serde = { version = "1", features = ["derive"] } serde_json = "^1" bytes = "1.0" @@ -27,4 +27,3 @@ tracing = { version = "0.1", features = ["log"] } tower = { version = "0.4", features = ["util"] } tokio-stream = "0.1.2" lambda_runtime_api_client = { version = "0.6", path = "../lambda-runtime-api-client" } - diff --git a/lambda-runtime/src/lib.rs b/lambda-runtime/src/lib.rs index 35f3c82f..b23c3cd2 100644 --- a/lambda-runtime/src/lib.rs +++ b/lambda-runtime/src/lib.rs @@ -31,7 +31,7 @@ pub use types::{Context, LambdaEvent}; pub type Error = lambda_runtime_api_client::Error; /// Configuration derived from environment variables. -#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Serialize, Deserialize)] pub struct Config { /// The name of the function. pub function_name: String, diff --git a/lambda-runtime/src/requests.rs b/lambda-runtime/src/requests.rs index 4d033614..97fc7e4d 100644 --- a/lambda-runtime/src/requests.rs +++ b/lambda-runtime/src/requests.rs @@ -14,7 +14,7 @@ pub(crate) trait IntoResponse { } // /runtime/invocation/next -#[derive(Debug, PartialEq)] +#[derive(Debug, Eq, PartialEq)] pub(crate) struct NextEventRequest; impl IntoRequest for NextEventRequest { @@ -27,7 +27,7 @@ impl IntoRequest for NextEventRequest { } } -#[derive(Debug, PartialEq)] +#[derive(Debug, Eq, PartialEq)] pub struct NextEventResponse<'a> { // lambda-runtime-aws-request-id pub request_id: &'a str, diff --git a/lambda-runtime/src/types.rs b/lambda-runtime/src/types.rs index ee71ba1c..b9e36702 100644 --- a/lambda-runtime/src/types.rs +++ b/lambda-runtime/src/types.rs @@ -3,7 +3,7 @@ use http::{HeaderMap, HeaderValue}; use serde::{Deserialize, Serialize}; use std::{collections::HashMap, convert::TryFrom}; -#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)] +#[derive(Debug, Eq, PartialEq, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub(crate) struct Diagnostic { pub(crate) error_type: String, @@ -28,33 +28,33 @@ fn round_trip_lambda_error() -> Result<(), Error> { /// The request ID, which identifies the request that triggered the function invocation. This header /// tracks the invocation within the Lambda control plane. The request ID is used to specify completion /// of a given invocation. -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq)] pub struct RequestId(pub String); /// The date that the function times out in Unix time milliseconds. For example, `1542409706888`. -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq)] pub struct InvocationDeadline(pub u64); /// The ARN of the Lambda function, version, or alias that is specified in the invocation. /// For instance, `arn:aws:lambda:us-east-2:123456789012:function:custom-runtime`. -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq)] pub struct FunctionArn(pub String); /// The AWS X-Ray Tracing header. For more information, /// please see [AWS' documentation](https://docs.aws.amazon.com/xray/latest/devguide/xray-concepts.html#xray-concepts-tracingheader). -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq)] pub struct XRayTraceId(pub String); /// For invocations from the AWS Mobile SDK contains data about client application and device. -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq)] struct MobileClientContext(String); /// For invocations from the AWS Mobile SDK, data about the Amazon Cognito identity provider. -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq)] struct MobileClientIdentity(String); /// Client context sent by the AWS Mobile SDK. -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)] pub struct ClientContext { /// Information about the mobile application invoking the function. #[serde(default)] @@ -68,7 +68,7 @@ pub struct ClientContext { } /// AWS Mobile SDK client fields. -#[derive(Serialize, Deserialize, Default, Clone, Debug, PartialEq)] +#[derive(Serialize, Deserialize, Default, Clone, Debug, Eq, PartialEq)] #[serde(rename_all = "camelCase")] pub struct ClientApplication { /// The mobile app installation id @@ -84,7 +84,7 @@ pub struct ClientApplication { } /// Cognito identity information sent with the event -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)] pub struct CognitoIdentity { /// The unique identity id for the Cognito credentials invoking the function. pub identity_id: String, @@ -96,7 +96,7 @@ pub struct CognitoIdentity { /// are populated using the [Lambda environment variables](https://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html) /// and the headers returned by the poll request to the Runtime APIs. #[non_exhaustive] -#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Default, Serialize, Deserialize)] pub struct Context { /// The AWS request ID generated by the Lambda service. pub request_id: String,