Skip to content

Commit 5d3e916

Browse files
authored
feat(ci): build and check rustdocs for warnings; fix(docs): add missing cfg flag to allow displaying features on doc.rs, fix various warnings (#998)
* feat(ci): check rustdocs on build * fix(docs): enable `#![cfg_attr(docsrs, feature(doc_cfg))]` to allow rustdoc feature display * fix(docs): fix assorted rustdoc warnings
1 parent 489b235 commit 5d3e916

File tree

36 files changed

+87
-44
lines changed

36 files changed

+87
-44
lines changed

.github/workflows/check-docs.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Check rustdocs
2+
# this is its own workflow since we to to use unstable
3+
# to have the docs.rs display of feature flags
4+
5+
on:
6+
push:
7+
paths:
8+
- 'lambda-runtime/**'
9+
- 'lambda-runtime-api-client/**'
10+
- 'lambda-http/**'
11+
- 'lambda-events/**'
12+
- 'lambda-extension/**'
13+
- 'Cargo.toml'
14+
15+
pull_request:
16+
paths:
17+
- 'lambda-runtime/**'
18+
- 'lambda-runtime-api-client/**'
19+
- 'lambda-http/**'
20+
- 'lambda-events/**'
21+
- 'lambda-extension/**'
22+
- 'Cargo.toml'
23+
24+
jobs:
25+
build-runtime:
26+
runs-on: ubuntu-latest
27+
28+
env:
29+
RUST_BACKTRACE: 1
30+
steps:
31+
- uses: actions/checkout@v3
32+
- uses: dtolnay/rust-toolchain@nightly
33+
34+
- name: Check documentation
35+
shell: bash
36+
env:
37+
RUSTFLAGS: --cfg docsrs
38+
RUSTDOCFLAGS: --cfg docsrs -Dwarnings
39+
run: cargo doc --no-deps --document-private-items --all-features

examples/advanced-sqs-partial-batch-failures/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ async fn main() -> Result<(), Error> {
4444
/// Important note: your lambda sqs trigger *needs* to be configured with partial batch response support
4545
/// with the ` ReportBatchItemFailures` flag set to true, otherwise failed message will be dropped,
4646
/// for more details see:
47-
/// https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html#services-sqs-batchfailurereporting
47+
/// <https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html#services-sqs-batchfailurereporting>
4848
///
4949
///
5050
/// Note that if you are looking for parallel processing (multithread) instead of concurrent processing,

examples/basic-error-handling/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/// See https://github.com/awslabs/aws-lambda-rust-runtime for more info on Rust runtime for AWS Lambda
1+
/// See <https://github.com/awslabs/aws-lambda-rust-runtime> for more info on Rust runtime for AWS Lambda
22
use lambda_runtime::{service_fn, tracing, Error, LambdaEvent};
33
use serde::{Deserialize, Serialize};
44
use serde_json::json;

examples/http-basic-lambda/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use lambda_http::{run, service_fn, tracing, Body, Error, Request, Response};
33
/// This is the main body for the function.
44
/// Write your code inside it.
55
/// There are some code examples in the Runtime repository:
6-
/// - https://github.com/awslabs/aws-lambda-rust-runtime/tree/main/examples
6+
/// - <https://github.com/awslabs/aws-lambda-rust-runtime/tree/main/examples>
77
async fn function_handler(_event: Request) -> Result<Response<Body>, Error> {
88
// Extract some useful information from the request
99

examples/http-dynamodb/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub struct Item {
1515
/// This is the main body for the function.
1616
/// Write your code inside it.
1717
/// You can see more examples in Runtime's repository:
18-
/// - https://github.com/awslabs/aws-lambda-rust-runtime/tree/main/examples
18+
/// - <https://github.com/awslabs/aws-lambda-rust-runtime/tree/main/examples>
1919
async fn handle_request(db_client: &Client, event: Request) -> Result<Response<Body>, Error> {
2020
// Extract some useful information from the request
2121
let body = event.body();

examples/http-query-parameters/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use lambda_http::{run, service_fn, tracing, Error, IntoResponse, Request, Reques
33
/// This is the main body for the function.
44
/// Write your code inside it.
55
/// You can see more examples in Runtime's repository:
6-
/// - https://github.com/awslabs/aws-lambda-rust-runtime/tree/main/examples
6+
/// - <https://github.com/awslabs/aws-lambda-rust-runtime/tree/main/examples>
77
async fn function_handler(event: Request) -> Result<impl IntoResponse, Error> {
88
// Extract some useful information from the request
99
Ok(

lambda-events/src/custom_serde/float_unix_epoch.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ where
5757
struct SecondsFloatTimestampVisitor;
5858

5959
/// Serialize a UTC datetime into an float number of seconds since the epoch
60-
/// ```
6160
pub fn serialize<S>(dt: &DateTime<Utc>, serializer: S) -> Result<S::Ok, S::Error>
6261
where
6362
S: ser::Serializer,

lambda-events/src/custom_serde/headers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use serde::{
55
};
66
use std::{borrow::Cow, fmt};
77

8-
/// Serialize a http::HeaderMap into a serde str => Vec<str> map
8+
/// Serialize a http::HeaderMap into a serde str => `Vec<str>` map
99
pub(crate) fn serialize_multi_value_headers<S>(headers: &HeaderMap, serializer: S) -> Result<S::Ok, S::Error>
1010
where
1111
S: Serializer,

lambda-events/src/event/appsync/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::collections::HashMap;
44

55
use crate::custom_serde::deserialize_lambda_map;
66

7-
/// Deprecated: `AppSyncResolverTemplate` does not represent resolver events sent by AppSync. Instead directly model your input schema, or use map[string]string, json.RawMessage, interface{}, etc..
7+
/// Deprecated: `AppSyncResolverTemplate` does not represent resolver events sent by AppSync. Instead directly model your input schema, or use `map[string]string`, `json.RawMessage`,` interface{}`, etc..
88
#[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)]
99
#[serde(rename_all = "camelCase")]
1010
pub struct AppSyncResolverTemplate<T1 = Value>

lambda-events/src/event/cloudformation/provider.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//!
33
//! Note that they are similar (but not the same) as the events in the `super` module.
44
//!
5-
//! See https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.custom_resources-readme.html for details.
5+
//! See <https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.custom_resources-readme.html> for details.
66
77
use serde::{de::DeserializeOwned, Deserialize, Serialize};
88
use serde_json::Value;

0 commit comments

Comments
 (0)