diff --git a/.github/bors.toml b/.github/bors.toml new file mode 100644 index 0000000..6d27f5a --- /dev/null +++ b/.github/bors.toml @@ -0,0 +1,7 @@ +block_labels = ["needs-decision"] +delete_merged_branches = true +required_approvals = 1 +status = [ + "ci-linux (stable, x86_64-unknown-linux-gnu)", + "ci-linux (1.35.0, x86_64-unknown-linux-gnu)", +] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..bb892e7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,45 @@ +on: + push: + branches: [ staging, trying, master ] + pull_request: + +name: Continuous integration + +jobs: + ci-linux: + runs-on: ubuntu-latest + strategy: + matrix: + # All generated code should be running on stable now + rust: [stable] + + # The default target we're compiling on and for + TARGET: [x86_64-unknown-linux-gnu] + + include: + # Test MSRV + - rust: 1.35.0 + TARGET: x86_64-unknown-linux-gnu + + # Test nightly but don't fail + - rust: nightly + experimental: true + TARGET: x86_64-unknown-linux-gnu + + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust }} + target: ${{ matrix.TARGET }} + override: true + - uses: actions-rs/cargo@v1 + with: + command: check + args: --target=${{ matrix.TARGET }} --features unstable + - uses: actions-rs/cargo@v1 + if: ${{ matrix.TARGET == 'nightly' }} + with: + command: test + args: --target=${{ matrix.TARGET }} --features unstable diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml new file mode 100644 index 0000000..adc3a6e --- /dev/null +++ b/.github/workflows/clippy.yml @@ -0,0 +1,20 @@ +on: + push: + branches: [ staging, trying, master ] + pull_request: + +name: Clippy check +jobs: + clippy_check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + components: clippy + - uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/rustfmt.yml b/.github/workflows/rustfmt.yml new file mode 100644 index 0000000..9a55c00 --- /dev/null +++ b/.github/workflows/rustfmt.yml @@ -0,0 +1,23 @@ +on: + push: + branches: [ staging, trying, master ] + pull_request: + +name: Code formatting check + +jobs: + fmt: + name: Rustfmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + components: rustfmt + - uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6115dd9..0000000 --- a/.travis.yml +++ /dev/null @@ -1,33 +0,0 @@ -language: rust - -matrix: - include: - - env: TARGET=x86_64-unknown-linux-gnu - rust: nightly - -before_install: set -e - -install: - - bash ci/install.sh - -script: - - bash ci/script.sh - -after_script: set +e - -after_success: - - bash ci/after_success.sh - -cache: cargo -before_cache: - # Travis can't cache files that are not readable by "others" - - chmod -R a+r $HOME/.cargo - -branches: - only: - - staging - - trying - -notifications: - email: - on_success: never diff --git a/bors.toml b/bors.toml deleted file mode 100644 index 5ccee21..0000000 --- a/bors.toml +++ /dev/null @@ -1,3 +0,0 @@ -status = [ - "continuous-integration/travis-ci/push", -] \ No newline at end of file diff --git a/ci/after_success.sh b/ci/after_success.sh deleted file mode 100644 index 8c4cf08..0000000 --- a/ci/after_success.sh +++ /dev/null @@ -1,20 +0,0 @@ -set -euxo pipefail - -main() { - cargo doc --target $TARGET - - mkdir ghp-import - - curl -Ls https://github.com/davisp/ghp-import/archive/master.tar.gz | \ - tar --strip-components 1 -C ghp-import -xz - - ./ghp-import/ghp_import.py target/$TARGET/doc - - set +x - git push -fq https://$GH_TOKEN@github.com/$TRAVIS_REPO_SLUG.git gh-pages && \ - echo OK -} - -if [ $TRAVIS_BRANCH = master ]; then - main -fi diff --git a/ci/install.sh b/ci/install.sh deleted file mode 100644 index 642d79a..0000000 --- a/ci/install.sh +++ /dev/null @@ -1,7 +0,0 @@ -set -euxo pipefail - -main() { - return -} - -main diff --git a/ci/script.sh b/ci/script.sh deleted file mode 100644 index ff6d7e9..0000000 --- a/ci/script.sh +++ /dev/null @@ -1,10 +0,0 @@ -set -euxo pipefail - -main() { - cargo check --target $TARGET - - cargo check --target $TARGET --features unstable - cargo test --target $TARGET --features unstable -} - -main diff --git a/src/lib.rs b/src/lib.rs index e11ead5..3bc561d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -393,7 +393,10 @@ where impl Error { /// Maps an `Error` to `Error` by applying a function to a contained /// `Error::Other` value, leaving an `Error::WouldBlock` value untouched. - pub fn map(self, op: F) -> Error where F: FnOnce(E) -> T { + pub fn map(self, op: F) -> Error + where + F: FnOnce(E) -> T, + { match self { Error::Other(e) => Error::Other(op(e)), Error::WouldBlock => Error::WouldBlock, @@ -433,17 +436,18 @@ macro_rules! await { loop { #[allow(unreachable_patterns)] match $e { - Err($crate::Error::Other(e)) => { + Err($crate::Error::Other(e)) => + { #[allow(unreachable_code)] break Err(e) - }, - Err($crate::Error::WouldBlock) => {}, // yield (see below) + } + Err($crate::Error::WouldBlock) => {} // yield (see below) Ok(x) => break Ok(x), } yield } - } + }; } /// Turns the non-blocking expression `$e` into a blocking operation. @@ -465,15 +469,16 @@ macro_rules! block { loop { #[allow(unreachable_patterns)] match $e { - Err($crate::Error::Other(e)) => { + Err($crate::Error::Other(e)) => + { #[allow(unreachable_code)] break Err(e) - }, - Err($crate::Error::WouldBlock) => {}, + } + Err($crate::Error::WouldBlock) => {} Ok(x) => break Ok(x), } } - } + }; } /// Future adapter @@ -507,10 +512,8 @@ macro_rules! try_nb { ($e:expr) => { match $e { Err($crate::Error::Other(e)) => return Err(e), - Err($crate::Error::WouldBlock) => { - return Ok(::futures::Async::NotReady) - }, + Err($crate::Error::WouldBlock) => return Ok(::futures::Async::NotReady), Ok(x) => x, } - } + }; } diff --git a/triagebot.toml b/triagebot.toml new file mode 100644 index 0000000..fa0824a --- /dev/null +++ b/triagebot.toml @@ -0,0 +1 @@ +[assign]