Skip to content

Commit b52703f

Browse files
authored
Fix build (awslabs#6)
Revert some of the changes I made regarding code style that were a little bit too agressive. We can bring it back to 0 warnings incrementally. Signed-off-by: David Calavera <[email protected]>
1 parent e74d7cf commit b52703f

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,7 @@ jobs:
6464
- uses: actions-rs/toolchain@v1
6565
with:
6666
toolchain: stable
67-
components:
68-
- rustfmt
69-
- clippy
67+
components: rustfmt
7068
override: true
7169
- name: Run fmt check
7270
run: cargo fmt --all -- --check
73-
- name: Run clippy check
74-
run: cargo clippy --all-targets --all-features -- -D warnings

lambda-attributes/src/lib.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,31 @@
1-
#![deny(clippy::all)]
1+
#![deny(missing_docs)]
2+
3+
//! The official Rust runtime for AWS Lambda.
4+
//!
5+
//! This package contains macro definitions to work with lambda.
6+
//!
7+
//! An asynchronous function annotated with the `#[lambda]` attribute must
8+
//! accept an argument of type `A` which implements [`serde::Deserialize`], a [`lambda::Context`] and
9+
//! return a `Result<B, E>`, where `B` implements [`serde::Serializable`]. `E` is
10+
//! any type that implements `Into<Box<dyn std::error::Error + Send + Sync + 'static>>`.
11+
//! ```
12+
213
extern crate proc_macro;
314

415
use proc_macro::TokenStream;
516
use quote::quote_spanned;
617
use syn::{spanned::Spanned, AttributeArgs, FnArg, ItemFn, Meta, NestedMeta};
718

819
/// Return true if attribute macro args declares http flavor in the form `#[lambda(http)]`
9-
fn is_http(args: &AttributeArgs) -> bool {
20+
fn is_http(args: AttributeArgs) -> bool {
1021
args.iter().any(|arg| match arg {
1122
NestedMeta::Meta(Meta::Path(path)) => path.is_ident("http"),
1223
_ => false,
1324
})
1425
}
1526

1627
#[proc_macro_attribute]
28+
/// Wrap an async function into the lambda constructs
1729
pub fn lambda(attr: TokenStream, item: TokenStream) -> TokenStream {
1830
let input = syn::parse_macro_input!(item as ItemFn);
1931
let args = syn::parse_macro_input!(attr as AttributeArgs);
@@ -63,7 +75,7 @@ pub fn lambda(attr: TokenStream, item: TokenStream) -> TokenStream {
6375
let context_name = &context.pat;
6476
let context_type = &context.ty;
6577

66-
if is_http(&args) {
78+
if is_http(args) {
6779
quote_spanned! { input.span() =>
6880

6981
#(#attrs)*

lambda-http/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#![deny(clippy::all)]
1+
#![deny(missing_docs)]
2+
23
//! Enriches the `lambda` crate with [`http`](https://github.com/hyperium/http)
34
//! 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.
45
//!

lambda-http/src/request.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,10 @@ pub struct ApiGatewayRequestContext {
156156
pub resource_id: String,
157157
/// The deployment stage of the API request (for example, Beta or Prod).
158158
pub stage: String,
159-
/// The domain name of the API Gateway.
160-
pub domain_name: String,
161-
/// The domain prefix of the API Gateway.
162-
pub domain_prefix: String,
163159
/// The ID that API Gateway assigns to the API request.
164160
pub request_id: String,
165161
/// The path to your resource. For example, for the non-proxy request URI of `https://{rest-api-id.execute-api.{region}.amazonaws.com/{stage}/root/child`, The $context.resourcePath value is /root/child.
166162
pub resource_path: String,
167-
/// The HTTP protocol used for this request.
168-
pub protocol: String,
169163
/// The HTTP method used. Valid values include: DELETE, GET, HEAD, OPTIONS, PATCH, POST, and PUT.
170164
pub http_method: String,
171165
/// The stringified value of the specified key-value pair of the context map returned from an API Gateway Lambda authorizer function.
@@ -175,11 +169,6 @@ pub struct ApiGatewayRequestContext {
175169
pub api_id: String,
176170
/// Cofnito identity information
177171
pub identity: Identity,
178-
/// The time of the request in String format.
179-
pub request_time: String,
180-
/// The epoch of the request.
181-
pub request_time_epoch: i64,
182-
pub operation_name: Option<String>,
183172
}
184173

185174
/// Elastic load balancer context information
@@ -255,6 +244,7 @@ pub struct Identity {
255244
/// For API methods that require an API key, this variable is the API key associated with the method request.
256245
/// For methods that don't require an API key, this variable is null.
257246
pub api_key: Option<String>,
247+
/// The identifier of an ApiKey used in a UsagePlan.
258248
pub api_key_id: Option<String>,
259249
/// Undocumented. Can be the API key ID associated with an API request that requires an API key.
260250
/// The description of `api_key` and `access_key` may actually be reversed.
@@ -790,7 +780,7 @@ mod tests {
790780
"user": ""
791781
},
792782
"resourcePath": "",
793-
"authorizer": null,
783+
"authorizer": {},
794784
"httpMethod": "",
795785
"requestTime": "",
796786
"requestTimeEpoch": 0,

lambda/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#![deny(clippy::all)]
1+
#![deny(clippy::all, clippy::cargo)]
2+
#![warn(missing_docs, nonstandard_style, rust_2018_idioms)]
23

34
//! The official Rust runtime for AWS Lambda.
45
//!

0 commit comments

Comments
 (0)