Skip to content

ensure a consistent style for all changes #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#merge_imports
merge_imports = true
# https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#max_width
max_width = 120
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ cache:
before_cache:
- rm -rf /home/travis/.cargo/registry

install: |
# this project's rustfmt style requires nightly features
if [[ "$TRAVIS_RUST_VERSION" == nightly ]]; then
rustup component add rustfmt
fi

matrix:
include:
- rust: 1.31.0
Expand All @@ -18,5 +24,9 @@ matrix:
- env: TARGET=x86_64-unknown-linux-musl
- env: TARGET=x86_64-unknown-linux-gnu
script:
- |
if [[ "$TRAVIS_RUST_VERSION" == nightly ]]; then
cargo fmt --all -- --check
fi
- cargo build --verbose --all
- cargo test --verbose --all
16 changes: 8 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Contributing Guidelines

Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional
Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional
documentation, we greatly value feedback and contributions from our community.

Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
information to effectively respond to your bug report or contribution.


## Reporting Bugs/Feature Requests

We welcome you to use the GitHub issue tracker to report bugs or suggest features.

When filing an issue, please check [existing open](https://github.com/awslabs/aws-lambda-rust-runtime/issues), or [recently closed](https://github.com/awslabs/aws-lambda-rust-runtime/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20), issues to make sure somebody else hasn't already
When filing an issue, please check [existing open](https://github.com/awslabs/aws-lambda-rust-runtime/issues), or [recently closed](https://github.com/awslabs/aws-lambda-rust-runtime/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20), issues to make sure somebody else hasn't already
reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:

* A reproducible test case or series of steps
Expand All @@ -32,21 +32,21 @@ To send us a pull request, please:
1. Fork the repository.
2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
3. Ensure local tests pass.
4. Commit to your fork using clear commit messages.
4. Commit to your fork using clear commit messages and ensure any Rust source files have been formatted with the [rustfmt tool](https://github.com/rust-lang/rustfmt#quick-start)
5. Send us a pull request, answering any default questions in the pull request interface.
6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.

GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
[creating a pull request](https://help.github.com/articles/creating-a-pull-request/).


## Finding contributions to work on
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ['help wanted'](https://github.com/awslabs/aws-lambda-rust-runtime/labels/help%20wanted) issues is a great place to start.
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ['help wanted'](https://github.com/awslabs/aws-lambda-rust-runtime/labels/help%20wanted) issues is a great place to start.


## Code of Conduct
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
[email protected] with any additional questions or comments.


Expand Down
7 changes: 2 additions & 5 deletions lambda-http/src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ use serde::{de::value::Error as SerdeError, Deserialize};
use serde_json;
use serde_urlencoded;

use crate::request::RequestContext;
use crate::strmap::StrMap;
use crate::{request::RequestContext, strmap::StrMap};

/// API gateway pre-parsed http query string parameters
pub(crate) struct QueryStringParameters(pub(crate) StrMap);
Expand Down Expand Up @@ -157,9 +156,7 @@ mod tests {
use serde_derive::Deserialize;
use std::collections::HashMap;

use crate::GatewayRequest;
use crate::RequestExt;
use crate::StrMap;
use crate::{GatewayRequest, RequestExt, StrMap};

#[test]
fn requests_have_query_string_ext() {
Expand Down
8 changes: 2 additions & 6 deletions lambda-http/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,8 @@ pub mod request;
mod response;
mod strmap;

pub use crate::body::Body;
pub use crate::ext::RequestExt;
use crate::request::GatewayRequest;
use crate::response::GatewayResponse;
pub use crate::response::IntoResponse;
pub use crate::strmap::StrMap;
pub use crate::{body::Body, ext::RequestExt, response::IntoResponse, strmap::StrMap};
use crate::{request::GatewayRequest, response::GatewayResponse};

/// Type alias for `http::Request`s with a fixed `lambda_http::Body` body
pub type Request = http::Request<Body>;
Expand Down
8 changes: 5 additions & 3 deletions lambda-http/src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ use serde::{
use serde_derive::Deserialize;
use serde_json::Value;

use crate::body::Body;
use crate::ext::{PathParameters, QueryStringParameters, StageVariables};
use crate::strmap::StrMap;
use crate::{
body::Body,
ext::{PathParameters, QueryStringParameters, StageVariables},
strmap::StrMap,
};

/// Representation of an API Gateway proxy event data
#[doc(hidden)]
Expand Down
3 changes: 1 addition & 2 deletions lambda-runtime/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use backtrace;
use chrono::Utc;
use lambda_runtime_client;

use crate::env as lambda_env;
use crate::error::HandlerError;
use crate::{env as lambda_env, error::HandlerError};

/// The Lambda function execution context. The values in this struct
/// are populated using the [Lambda environment variables](https://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html)
Expand Down
3 changes: 1 addition & 2 deletions lambda-runtime/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ impl ConfigProvider for EnvConfigProvider {

#[cfg(test)]
pub(crate) mod tests {
use crate::env::*;
use crate::error;
use crate::{env::*, error};
use std::{env, error::Error};

pub(crate) struct MockConfigProvider {
Expand Down
4 changes: 1 addition & 3 deletions lambda-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,4 @@ mod env;
pub mod error;
mod runtime;

pub use crate::context::*;
pub use crate::error::HandlerError;
pub use crate::runtime::*;
pub use crate::{context::*, error::HandlerError, runtime::*};
11 changes: 6 additions & 5 deletions lambda-runtime/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ use serde;
use serde_json;
use tokio::runtime::Runtime as TokioRuntime;

use crate::context::Context;
use crate::env::{ConfigProvider, EnvConfigProvider, FunctionSettings};
use crate::error::{HandlerError, RuntimeError};
use crate::{
context::Context,
env::{ConfigProvider, EnvConfigProvider, FunctionSettings},
error::{HandlerError, RuntimeError},
};

const MAX_RETRIES: i8 = 3;

Expand Down Expand Up @@ -323,8 +325,7 @@ where
#[cfg(test)]
pub(crate) mod tests {
use super::*;
use crate::context;
use crate::env;
use crate::{context, env};
use lambda_runtime_client::RuntimeClient;

#[test]
Expand Down