1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-27 16:52:58 +01:00

chore: specify external types for each crate (#496)

This commit is contained in:
Rob Ede 2023-10-30 00:07:28 +00:00 committed by GitHub
parent 61b6e01b02
commit f967562ac4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 96 additions and 1 deletions

View File

@ -41,3 +41,26 @@ jobs:
reporter: 'github-pr-check' reporter: 'github-pr-check'
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
clippy_flags: --workspace --all-features --tests --examples --bins -- -Dclippy::todo -Aunknown_lints clippy_flags: --workspace --all-features --tests --examples --bins -- -Dclippy::todo -Aunknown_lints
check-external-types:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust (nightly-2023-10-10)
uses: actions-rust-lang/setup-rust-toolchain@v1.5.0
with:
toolchain: nightly-2023-10-10
- name: Install just
uses: taiki-e/install-action@v2.20.2
with:
tool: just
- name: Install cargo-check-external-types
uses: taiki-e/cache-cargo-install-action@v1.2.2
with:
tool: cargo-check-external-types@0.1.10
- name: check external types
run: just check-external-types-all

View File

@ -13,6 +13,15 @@ license = "MIT OR Apache-2.0"
edition.workspace = true edition.workspace = true
rust-version.workspace = true rust-version.workspace = true
[package.metadata.cargo_check_external_types]
allowed_external_types = [
"bytes::*",
"futures_core::*",
"futures_sink::*",
"tokio::*",
"tokio_util::*",
]
[dependencies] [dependencies]
bitflags = "2" bitflags = "2"
bytes = "1" bytes = "1"

View File

@ -14,6 +14,11 @@ license = "MIT OR Apache-2.0"
edition.workspace = true edition.workspace = true
rust-version.workspace = true rust-version.workspace = true
[package.metadata.cargo_check_external_types]
allowed_external_types = [
"tokio::*",
]
[features] [features]
default = ["macros"] default = ["macros"]
macros = ["actix-macros"] macros = ["actix-macros"]

View File

@ -15,6 +15,11 @@ license = "MIT OR Apache-2.0"
edition.workspace = true edition.workspace = true
rust-version.workspace = true rust-version.workspace = true
[package.metadata.cargo_check_external_types]
allowed_external_types = [
"tokio::*",
]
[features] [features]
default = [] default = []
io-uring = ["tokio-uring", "actix-rt/io-uring"] io-uring = ["tokio-uring", "actix-rt/io-uring"]

View File

@ -17,6 +17,14 @@ rust-version.workspace = true
all-features = true all-features = true
rustdoc-args = ["--cfg", "docsrs"] rustdoc-args = ["--cfg", "docsrs"]
[package.metadata.cargo_check_external_types]
allowed_external_types = [
"actix_service::*",
"actix_utils::*",
"futures_core::*",
"tokio::*",
]
[package.metadata.cargo-machete] [package.metadata.cargo-machete]
ignored = [ ignored = [
"rustls_021", # specified to force version with add_trust_anchors method "rustls_021", # specified to force version with add_trust_anchors method

View File

@ -12,6 +12,14 @@ license = "MIT OR Apache-2.0"
edition.workspace = true edition.workspace = true
rust-version.workspace = true rust-version.workspace = true
[package.metadata.cargo_check_external_types]
allowed_external_types = [
"actix_service::*",
"actix_utils::*",
"tracing::*",
"tracing_futures::*",
]
[dependencies] [dependencies]
actix-service = "2" actix-service = "2"
actix-utils = "3" actix-utils = "3"

View File

@ -9,11 +9,17 @@ authors = [
keywords = ["string", "bytes", "utf8", "web", "actix"] keywords = ["string", "bytes", "utf8", "web", "actix"]
categories = ["no-std", "web-programming"] categories = ["no-std", "web-programming"]
homepage = "https://actix.rs" homepage = "https://actix.rs"
repository = "https://github.com/actix/actix-net.git" repository = "https://github.com/actix/actix-net"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
edition.workspace = true edition.workspace = true
rust-version.workspace = true rust-version.workspace = true
[package.metadata.cargo_check_external_types]
allowed_external_types = [
"bytes::*",
"serde::*",
]
[dependencies] [dependencies]
bytes = { version = "1.2", default-features = false } bytes = { version = "1.2", default-features = false }
serde = { version = "1.0", optional = true } serde = { version = "1.0", optional = true }

View File

@ -9,3 +9,28 @@ doc:
doc-watch: doc-watch:
RUSTDOCFLAGS="--cfg=docsrs" cargo +nightly doc --no-deps --workspace --features=rustls,openssl --open RUSTDOCFLAGS="--cfg=docsrs" cargo +nightly doc --no-deps --workspace --features=rustls,openssl --open
cargo watch -- RUSTDOCFLAGS="--cfg=docsrs" cargo +nightly doc --no-deps --workspace --features=rustls,openssl cargo watch -- RUSTDOCFLAGS="--cfg=docsrs" cargo +nightly doc --no-deps --workspace --features=rustls,openssl
# Check for unintentional external type exposure on all crates in workspace.
check-external-types-all:
#!/usr/bin/env bash
set -euo pipefail
for f in $(find . -mindepth 2 -maxdepth 2 -name Cargo.toml); do
echo "Checking for $f"
just check-external-types-manifest "$f" || true
echo
echo
done
# Check for unintentional external type exposure on all crates in workspace.
check-external-types-all-table:
#!/usr/bin/env bash
set -euo pipefail
for f in $(find . -mindepth 2 -maxdepth 2 -name Cargo.toml); do
echo
echo "Checking for $f"
just check-external-types-manifest "$f" --output-format=markdown-table
done
# Check for unintentional external type exposure on a crate.
check-external-types-manifest manifest_path *extra_args:
cargo +nightly check-external-types --manifest-path "{{manifest_path}}" {{extra_args}}

View File

@ -12,6 +12,12 @@ license.workspace = true
edition.workspace = true edition.workspace = true
rust-version.workspace = true rust-version.workspace = true
[package.metadata.cargo_check_external_types]
allowed_external_types = [
"futures_core::*",
"futures_sink::*",
]
[dependencies] [dependencies]
futures-core = "0.3.17" futures-core = "0.3.17"
futures-sink = "0.3.17" futures-sink = "0.3.17"