From f37c93a2a8895cee2ed9697778bae91310a9a012 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Sun, 9 Apr 2023 19:41:57 +0100 Subject: [PATCH] migrate to doc_auto_cfg --- .github/workflows/ci-post-merge.yml | 3 +-- .github/workflows/ci.yml | 12 +++++------- .github/workflows/coverage.yml | 18 +++++------------- .github/workflows/lint.yml | 13 ++++++++----- .github/workflows/upload-doc.yml | 10 ++++------ actix-cors/src/builder.rs | 1 - actix-cors/src/lib.rs | 2 +- actix-session/src/lib.rs | 2 +- actix-session/src/storage/cookie.rs | 1 - actix-session/src/storage/redis_actor.rs | 2 -- actix-session/src/storage/redis_rs.rs | 2 -- 11 files changed, 25 insertions(+), 41 deletions(-) diff --git a/.github/workflows/ci-post-merge.yml b/.github/workflows/ci-post-merge.yml index ebcab14b8..e97973976 100644 --- a/.github/workflows/ci-post-merge.yml +++ b/.github/workflows/ci-post-merge.yml @@ -3,8 +3,7 @@ name: CI (post-merge) on: push: { branches: [master] } -permissions: - contents: read # to fetch code (actions/checkout) +permissions: { contents: read } concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab9b9b32d..84e502340 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,8 +4,7 @@ on: pull_request: {} push: { branches: [master] } -permissions: - contents: read # to fetch code (actions/checkout) +permissions: { contents: read } concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -45,7 +44,8 @@ jobs: with: toolchain: ${{ matrix.version }} - - uses: taiki-e/cache-cargo-install-action@v1 + - name: Install cargo-hack + uses: taiki-e/cache-cargo-install-action@v1 with: { tool: cargo-hack } - name: workaround MSRV issues @@ -97,10 +97,8 @@ jobs: with: toolchain: ${{ matrix.version }} - - uses: taiki-e/cache-cargo-install-action@v1 - with: { tool: cargo-hack } - - - uses: taiki-e/cache-cargo-install-action@v1 + - name: Install cargo-hack + uses: taiki-e/cache-cargo-install-action@v1 with: { tool: cargo-hack } - name: workaround MSRV issues diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index ab01eaece..000149436 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -1,12 +1,9 @@ -# disabled because `cargo tarpaulin` currently segfaults - name: Coverage on: push: { branches: [master] } -permissions: - contents: read # to fetch code (actions/checkout) +permissions: { contents: read } concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -26,20 +23,15 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Install stable - run: | - rustup override set stable - rustup update stable - - - name: Generate Cargo.lock - run: cargo generate-lockfile - - name: Cache Dependencies - uses: Swatinem/rust-cache@v2.1.0 + - name: Install Rust (nightly) + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: { toolchain: nightly } - name: Generate coverage file run: | cargo install cargo-tarpaulin --vers "^0.13" cargo tarpaulin --workspace --out Xml --verbose + - name: Upload to Codecov uses: codecov/codecov-action@v3 with: { file: cobertura.xml } diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 2ff3c7b0d..97ad9cec4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -2,8 +2,7 @@ name: Lint on: [pull_request] -permissions: - contents: read # to fetch code (actions/checkout) +permissions: { contents: read } concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -47,14 +46,18 @@ jobs: - name: checkout ${{ github.head_ref }} uses: actions/checkout@v3 - - uses: actions-rust-lang/setup-rust-toolchain@v1 + - name: Install Rust (nightly) + uses: actions-rust-lang/setup-rust-toolchain@v1 with: { toolchain: nightly } - - uses: taiki-e/cache-cargo-install-action@v1 + - name: Install cargo-public-api + uses: taiki-e/cache-cargo-install-action@v1 with: { tool: cargo-public-api } - name: generate API diff run: | for f in $(find -mindepth 2 -maxdepth 2 -name Cargo.toml); do - cargo public-api --manifest-path "$f" --all-features diff ${{ github.event.pull_request.base.sha }}..${{ github.sha }} + + cargo public-api --manifest-path "$f" --all-features diff ${{ github.event.pull_request.base.sha }}..${{ github.sha }} >> /tmp/diff.txt done + cat /tmp/diff.txt diff --git a/.github/workflows/upload-doc.yml b/.github/workflows/upload-doc.yml index 90fb8b56a..a59f7f22f 100644 --- a/.github/workflows/upload-doc.yml +++ b/.github/workflows/upload-doc.yml @@ -3,8 +3,7 @@ name: Upload Documentation on: push: { branches: [master] } -permissions: - contents: read # to fetch code (actions/checkout) +permissions: { contents: write } concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -17,10 +16,9 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Install Rust - run: | - rustup override set nightly - rustup update nightly + - name: Install Rust (nightly) + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: { toolchain: nightly } - name: Build Docs run: cargo doc --workspace --all-features --no-deps diff --git a/actix-cors/src/builder.rs b/actix-cors/src/builder.rs index a985b212b..2b224d538 100644 --- a/actix-cors/src/builder.rs +++ b/actix-cors/src/builder.rs @@ -431,7 +431,6 @@ impl Cors { /// /// [Private Network Access]: https://wicg.github.io/local-network-access #[cfg(feature = "draft-local-network-access")] - #[cfg_attr(docsrs, doc(cfg(feature = "draft-local-network-access")))] pub fn allow_local_network_access(mut self) -> Cors { if let Some(cors) = cors(&mut self.inner, &self.error) { cors.allow_local_network_access = true; diff --git a/actix-cors/src/lib.rs b/actix-cors/src/lib.rs index f18fce1c4..622502841 100644 --- a/actix-cors/src/lib.rs +++ b/actix-cors/src/lib.rs @@ -53,7 +53,7 @@ #![warn(future_incompatible, missing_docs, missing_debug_implementations)] #![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")] -#![cfg_attr(docsrs, feature(doc_cfg))] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] mod all_or_some; mod builder; diff --git a/actix-session/src/lib.rs b/actix-session/src/lib.rs index cebe707bc..fbacce290 100644 --- a/actix-session/src/lib.rs +++ b/actix-session/src/lib.rs @@ -138,7 +138,7 @@ #![warn(future_incompatible, missing_docs)] #![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")] -#![cfg_attr(docsrs, feature(doc_cfg))] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] pub mod config; mod middleware; diff --git a/actix-session/src/storage/cookie.rs b/actix-session/src/storage/cookie.rs index 10cc05bc6..d4144ccce 100644 --- a/actix-session/src/storage/cookie.rs +++ b/actix-session/src/storage/cookie.rs @@ -47,7 +47,6 @@ use crate::storage::{ /// storage backend. /// /// [`CookieContentSecurity::Private`]: crate::config::CookieContentSecurity::Private -#[cfg_attr(docsrs, doc(cfg(feature = "cookie-session")))] #[derive(Default)] #[non_exhaustive] pub struct CookieSessionStore; diff --git a/actix-session/src/storage/redis_actor.rs b/actix-session/src/storage/redis_actor.rs index 744f01156..975df10c9 100644 --- a/actix-session/src/storage/redis_actor.rs +++ b/actix-session/src/storage/redis_actor.rs @@ -53,7 +53,6 @@ use crate::storage::{ /// Redis. Use [`RedisSessionStore`] if you need TLS support. /// /// [`RedisSessionStore`]: crate::storage::RedisSessionStore -#[cfg_attr(docsrs, doc(cfg(feature = "redis-actor-session")))] pub struct RedisActorSessionStore { configuration: CacheConfiguration, addr: Addr, @@ -93,7 +92,6 @@ impl Default for CacheConfiguration { /// A fluent builder to construct a [`RedisActorSessionStore`] instance with custom configuration /// parameters. -#[cfg_attr(docsrs, doc(cfg(feature = "redis-actor-session")))] #[must_use] pub struct RedisActorSessionStoreBuilder { connection_string: String, diff --git a/actix-session/src/storage/redis_rs.rs b/actix-session/src/storage/redis_rs.rs index 04a780279..86db45a3e 100644 --- a/actix-session/src/storage/redis_rs.rs +++ b/actix-session/src/storage/redis_rs.rs @@ -60,7 +60,6 @@ use crate::storage::{ /// `RedisSessionStore` leverages [`redis-rs`] as Redis client. /// /// [`redis-rs`]: https://github.com/mitsuhiko/redis-rs -#[cfg_attr(docsrs, doc(cfg(feature = "redis-rs-session")))] #[derive(Clone)] pub struct RedisSessionStore { configuration: CacheConfiguration, @@ -105,7 +104,6 @@ impl RedisSessionStore { /// parameters. /// /// [`RedisSessionStore`]: crate::storage::RedisSessionStore -#[cfg_attr(docsrs, doc(cfg(feature = "redis-rs-session")))] #[must_use] pub struct RedisSessionStoreBuilder { connection_string: String,