From ecba6e21da7e052f97bb9498255a75bb32ffc3cc Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Sun, 29 Dec 2024 14:27:56 +0000 Subject: [PATCH] chore: fmt project --- .github/PULL_REQUEST_TEMPLATE.md | 7 ++++--- .github/workflows/ci.yml | 2 +- .taplo.toml | 29 ++++++++++++++++++++++++++++ Cargo.toml | 6 ++++++ actix-codec/Cargo.toml | 16 +++++---------- actix-codec/benches/lines.rs | 2 ++ actix-codec/src/lib.rs | 2 -- actix-macros/Cargo.toml | 11 +++++++---- actix-macros/src/lib.rs | 2 -- actix-rt/Cargo.toml | 13 +++++-------- actix-rt/src/lib.rs | 2 -- actix-server/Cargo.toml | 16 +++++++-------- actix-server/examples/file-reader.rs | 2 ++ actix-server/src/lib.rs | 2 -- actix-server/src/socket.rs | 1 + actix-service/Cargo.toml | 8 ++++---- actix-service/examples/clone.rs | 2 ++ actix-service/src/lib.rs | 2 -- actix-tls/Cargo.toml | 24 +++++++++-------------- actix-tls/src/lib.rs | 2 -- actix-tracing/Cargo.toml | 11 ++++------- actix-tracing/src/lib.rs | 4 ++-- actix-utils/Cargo.toml | 10 +++++----- actix-utils/src/lib.rs | 2 -- bytestring/Cargo.toml | 13 +++++-------- bytestring/src/lib.rs | 2 -- local-channel/Cargo.toml | 10 ++-------- local-waker/Cargo.toml | 5 +---- 28 files changed, 104 insertions(+), 104 deletions(-) create mode 100644 .taplo.toml diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index e32d54ae..5f7542cc 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,10 +1,12 @@ ## PR Type + + INSERT_PR_TYPE - ## PR Checklist + Check your PR fulfills the following: @@ -14,11 +16,10 @@ Check your PR fulfills the following: - [ ] A changelog entry has been made for the appropriate packages. - [ ] Format code with the latest stable rustfmt - ## Overview + - diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 97cf5fd4..c3809715 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,7 @@ jobs: - name: Setup mold linker if: matrix.target.os == 'ubuntu-latest' uses: rui314/setup-mold@v1 - + - name: Install nasm if: matrix.target.os == 'windows-latest' uses: ilammy/setup-nasm@v1.5.1 diff --git a/.taplo.toml b/.taplo.toml new file mode 100644 index 00000000..195e07b3 --- /dev/null +++ b/.taplo.toml @@ -0,0 +1,29 @@ +exclude = ["target/*"] +include = ["**/*.toml"] + +[formatting] +column_width = 110 + +[[rule]] +include = ["**/Cargo.toml"] +keys = [ + "dependencies", + "*-dependencies", + "workspace.dependencies", + "workspace.*-dependencies", + "target.*.dependencies", + "target.*.*-dependencies", +] +formatting.reorder_keys = true + +[[rule]] +include = ["**/Cargo.toml"] +keys = [ + "dependencies.*", + "*-dependencies.*", + "workspace.dependencies.*", + "workspace.*-dependencies.*", + "target.*.dependencies", + "target.*.*-dependencies", +] +formatting.reorder_keys = false diff --git a/Cargo.toml b/Cargo.toml index 3ff0b548..164529aa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,3 +36,9 @@ local-waker = { path = "local-waker" } lto = true opt-level = 3 codegen-units = 1 + +[workspace.lints.rust] +rust_2018_idioms = "deny" +nonstandard-style = "deny" +future_incompatible = "deny" +missing_docs = { level = "warn", priority = -1 } diff --git a/actix-codec/Cargo.toml b/actix-codec/Cargo.toml index d71c7c25..89e0396a 100644 --- a/actix-codec/Cargo.toml +++ b/actix-codec/Cargo.toml @@ -1,10 +1,7 @@ [package] name = "actix-codec" version = "0.5.2" -authors = [ - "Nikolay Kim ", - "Rob Ede ", -] +authors = ["Nikolay Kim ", "Rob Ede "] description = "Codec utilities for working with framed protocols" keywords = ["network", "framework", "async", "futures"] repository = "https://github.com/actix/actix-net" @@ -14,13 +11,7 @@ edition.workspace = true rust-version.workspace = true [package.metadata.cargo_check_external_types] -allowed_external_types = [ - "bytes::*", - "futures_core::*", - "futures_sink::*", - "tokio::*", - "tokio_util::*", -] +allowed_external_types = ["bytes::*", "futures_core::*", "futures_sink::*", "tokio::*", "tokio_util::*"] [dependencies] bitflags = "2" @@ -40,3 +31,6 @@ tokio-test = "0.4.2" [[bench]] name = "lines" harness = false + +[lints] +workspace = true diff --git a/actix-codec/benches/lines.rs b/actix-codec/benches/lines.rs index e32b8365..c6d13123 100644 --- a/actix-codec/benches/lines.rs +++ b/actix-codec/benches/lines.rs @@ -1,3 +1,5 @@ +#![allow(missing_docs)] + use bytes::BytesMut; use criterion::{criterion_group, criterion_main, Criterion}; diff --git a/actix-codec/src/lib.rs b/actix-codec/src/lib.rs index 7dc28b35..f207c21c 100644 --- a/actix-codec/src/lib.rs +++ b/actix-codec/src/lib.rs @@ -6,8 +6,6 @@ //! [`Sink`]: futures_sink::Sink //! [`Stream`]: futures_core::Stream -#![deny(rust_2018_idioms, nonstandard_style)] -#![warn(future_incompatible, missing_docs)] #![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")] diff --git a/actix-macros/Cargo.toml b/actix-macros/Cargo.toml index bf20ab80..d4bfcfe5 100644 --- a/actix-macros/Cargo.toml +++ b/actix-macros/Cargo.toml @@ -2,9 +2,9 @@ name = "actix-macros" version = "0.2.4" authors = [ - "Nikolay Kim ", - "Ibraheem Ahmed ", - "Rob Ede ", + "Nikolay Kim ", + "Ibraheem Ahmed ", + "Rob Ede ", ] description = "Macros for Actix system and runtime" repository = "https://github.com/actix/actix-net" @@ -15,7 +15,7 @@ rust-version.workspace = true [package.metadata.cargo-machete] ignored = [ - "proc_macro2", # specified for minimal versions compat + "proc_macro2", # specified for minimal versions compat ] [lib] @@ -34,3 +34,6 @@ actix-rt = "2" futures-util = { version = "0.3.17", default-features = false } rustversion-msrv = "0.100" trybuild = "1" + +[lints] +workspace = true diff --git a/actix-macros/src/lib.rs b/actix-macros/src/lib.rs index cd546f0e..f2d96d4c 100644 --- a/actix-macros/src/lib.rs +++ b/actix-macros/src/lib.rs @@ -8,8 +8,6 @@ //! # Tests //! See docs for the [`#[test]`](macro@test) macro. -#![deny(rust_2018_idioms, nonstandard_style)] -#![warn(future_incompatible)] #![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")] diff --git a/actix-rt/Cargo.toml b/actix-rt/Cargo.toml index b46ad896..bee209cc 100644 --- a/actix-rt/Cargo.toml +++ b/actix-rt/Cargo.toml @@ -1,10 +1,7 @@ [package] name = "actix-rt" version = "2.10.0" -authors = [ - "Nikolay Kim ", - "Rob Ede ", -] +authors = ["Nikolay Kim ", "Rob Ede "] description = "Tokio-based single-threaded async runtime for the Actix ecosystem" keywords = ["async", "futures", "io", "runtime"] homepage = "https://actix.rs" @@ -15,10 +12,7 @@ edition.workspace = true rust-version.workspace = true [package.metadata.cargo_check_external_types] -allowed_external_types = [ - "actix_macros::*", - "tokio::*", -] +allowed_external_types = ["actix_macros::*", "tokio::*"] [features] default = ["macros"] @@ -37,3 +31,6 @@ tokio-uring = { version = "0.5", optional = true } [dev-dependencies] tokio = { version = "1.23.1", features = ["full"] } + +[lints] +workspace = true diff --git a/actix-rt/src/lib.rs b/actix-rt/src/lib.rs index fc2a56ba..9dce19b8 100644 --- a/actix-rt/src/lib.rs +++ b/actix-rt/src/lib.rs @@ -41,8 +41,6 @@ //! Note that there are currently some unimplemented parts of using `actix-rt` with `io-uring`. //! In particular, when running a `System`, only `System::block_on` is supported. -#![deny(rust_2018_idioms, nonstandard_style)] -#![warn(future_incompatible, missing_docs)] #![allow(clippy::type_complexity)] #![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")] diff --git a/actix-server/Cargo.toml b/actix-server/Cargo.toml index a1eecdd3..6de58fb9 100644 --- a/actix-server/Cargo.toml +++ b/actix-server/Cargo.toml @@ -2,9 +2,9 @@ name = "actix-server" version = "2.5.0" authors = [ - "Nikolay Kim ", - "Rob Ede ", - "Ali MJ Al-Nasrawy ", + "Nikolay Kim ", + "Rob Ede ", + "Ali MJ Al-Nasrawy ", ] description = "General purpose TCP server built for the Actix ecosystem" keywords = ["network", "tcp", "server", "framework", "async"] @@ -16,9 +16,7 @@ edition.workspace = true rust-version.workspace = true [package.metadata.cargo_check_external_types] -allowed_external_types = [ - "tokio::*", -] +allowed_external_types = ["tokio::*"] [features] default = [] @@ -28,7 +26,6 @@ io-uring = ["tokio-uring", "actix-rt/io-uring"] actix-rt = { version = "2.10", default-features = false } actix-service = "2" actix-utils = "3" - futures-core = { version = "0.3.17", default-features = false, features = ["alloc"] } futures-util = { version = "0.3.17", default-features = false, features = ["alloc"] } mio = { version = "1", features = ["os-poll", "net"] } @@ -45,6 +42,9 @@ actix-codec = "0.5" actix-rt = "2.8" bytes = "1" -pretty_env_logger = "0.5" futures-util = { version = "0.3.17", default-features = false, features = ["sink", "async-await-macro"] } +pretty_env_logger = "0.5" tokio = { version = "1.23.1", features = ["io-util", "rt-multi-thread", "macros", "fs"] } + +[lints] +workspace = true diff --git a/actix-server/examples/file-reader.rs b/actix-server/examples/file-reader.rs index 4e446807..06de4653 100644 --- a/actix-server/examples/file-reader.rs +++ b/actix-server/examples/file-reader.rs @@ -8,6 +8,8 @@ //! //! Follow the prompt and enter a file path, relative or absolute. +#![allow(missing_docs)] + use std::io; use actix_codec::{Framed, LinesCodec}; diff --git a/actix-server/src/lib.rs b/actix-server/src/lib.rs index 24adf8ff..8660d548 100644 --- a/actix-server/src/lib.rs +++ b/actix-server/src/lib.rs @@ -1,7 +1,5 @@ //! General purpose TCP server. -#![deny(rust_2018_idioms, nonstandard_style)] -#![warn(future_incompatible)] #![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")] diff --git a/actix-server/src/socket.rs b/actix-server/src/socket.rs index a39e4c49..91a73be8 100644 --- a/actix-server/src/socket.rs +++ b/actix-server/src/socket.rs @@ -160,6 +160,7 @@ pub enum MioStream { /// Helper trait for converting a Mio stream into a Tokio stream. pub trait FromStream: Sized { + /// Creates stream from a `mio` stream. fn from_mio(sock: MioStream) -> io::Result; } diff --git a/actix-service/Cargo.toml b/actix-service/Cargo.toml index dcb6652f..f0be441b 100644 --- a/actix-service/Cargo.toml +++ b/actix-service/Cargo.toml @@ -1,10 +1,7 @@ [package] name = "actix-service" version = "2.0.2" -authors = [ - "Nikolay Kim ", - "Rob Ede ", -] +authors = ["Nikolay Kim ", "Rob Ede "] description = "Service trait and combinators for representing asynchronous request/response operations." keywords = ["network", "framework", "async", "futures", "service"] categories = ["network-programming", "asynchronous", "no-std"] @@ -22,3 +19,6 @@ pin-project-lite = "0.2" actix-rt = "2" actix-utils = "3" futures-util = { version = "0.3.17", default-features = false } + +[lints] +workspace = true diff --git a/actix-service/examples/clone.rs b/actix-service/examples/clone.rs index 1f61a648..bc7ff1cb 100644 --- a/actix-service/examples/clone.rs +++ b/actix-service/examples/clone.rs @@ -1,3 +1,5 @@ +#![allow(missing_docs)] + use std::{future::Future, sync::mpsc, time::Duration}; async fn oracle(f: F) -> (u32, u32) diff --git a/actix-service/src/lib.rs b/actix-service/src/lib.rs index fbbdfeb8..963851ac 100644 --- a/actix-service/src/lib.rs +++ b/actix-service/src/lib.rs @@ -1,8 +1,6 @@ //! See [`Service`] docs for information on this crate's foundational trait. #![no_std] -#![deny(rust_2018_idioms, nonstandard_style)] -#![warn(future_incompatible, missing_docs)] #![allow(clippy::type_complexity)] #![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")] diff --git a/actix-tls/Cargo.toml b/actix-tls/Cargo.toml index 7d4cf563..1ec3cce2 100644 --- a/actix-tls/Cargo.toml +++ b/actix-tls/Cargo.toml @@ -1,10 +1,7 @@ [package] name = "actix-tls" version = "3.4.0" -authors = [ - "Nikolay Kim ", - "Rob Ede ", -] +authors = ["Nikolay Kim ", "Rob Ede "] description = "TLS acceptor and connector services for Actix ecosystem" keywords = ["network", "tls", "ssl", "async", "transport"] repository = "https://github.com/actix/actix-net.git" @@ -18,17 +15,12 @@ all-features = true rustdoc-args = ["--cfg", "docsrs"] [package.metadata.cargo_check_external_types] -allowed_external_types = [ - "actix_service::*", - "actix_utils::*", - "futures_core::*", - "tokio::*", -] +allowed_external_types = ["actix_service::*", "actix_utils::*", "futures_core::*", "tokio::*"] [package.metadata.cargo-machete] ignored = [ - "rustls_021", # specified to force version with add_trust_anchors method - "rustls_webpki_0101", # specified to force secure version + "rustls_021", # specified to force version with add_trust_anchors method + "rustls_webpki_0101", # specified to force secure version ] [features] @@ -76,7 +68,6 @@ uri = ["dep:http-0_2", "dep:http-1"] actix-rt = { version = "2.2", default-features = false } actix-service = "2" actix-utils = "3" - futures-core = { version = "0.3.7", default-features = false, features = ["alloc"] } impl-more = "0.1" pin-project-lite = "0.2.7" @@ -120,7 +111,7 @@ rustls-native-certs-07 = { package = "rustls-native-certs", version = "0.7", opt tokio-native-tls = { version = "0.3", optional = true } [target.'cfg(any())'.dependencies] -rustls-021 = { package = "rustls", version = "0.21.6", optional = true } # force version with add_trust_anchors method +rustls-021 = { package = "rustls", version = "0.21.6", optional = true } # force version with add_trust_anchors method rustls-webpki-0101 = { package = "rustls-webpki", version = "0.101.4", optional = true } # force secure version [dev-dependencies] @@ -128,9 +119,9 @@ actix-codec = "0.5" actix-rt = "2.2" actix-server = "2" bytes = "1" -pretty_env_logger = "0.5" futures-util = { version = "0.3.17", default-features = false, features = ["sink"] } itertools = "0.13" +pretty_env_logger = "0.5" rcgen = "0.13" rustls-pemfile = "2" tokio-rustls-026 = { package = "tokio-rustls", version = "0.26" } @@ -139,3 +130,6 @@ trust-dns-resolver = "0.23" [[example]] name = "accept-rustls" required-features = ["accept", "rustls-0_23"] + +[lints] +workspace = true diff --git a/actix-tls/src/lib.rs b/actix-tls/src/lib.rs index 64bdcd00..38d1bb05 100644 --- a/actix-tls/src/lib.rs +++ b/actix-tls/src/lib.rs @@ -1,7 +1,5 @@ //! TLS acceptor and connector services for the Actix ecosystem. -#![deny(rust_2018_idioms, nonstandard_style)] -#![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_auto_cfg))] diff --git a/actix-tracing/Cargo.toml b/actix-tracing/Cargo.toml index 6e06beed..8e4e0db2 100644 --- a/actix-tracing/Cargo.toml +++ b/actix-tracing/Cargo.toml @@ -13,20 +13,17 @@ edition.workspace = true rust-version.workspace = true [package.metadata.cargo_check_external_types] -allowed_external_types = [ - "actix_service::*", - "actix_utils::*", - "tracing::*", - "tracing_futures::*", -] +allowed_external_types = ["actix_service::*", "actix_utils::*", "tracing::*", "tracing_futures::*"] [dependencies] actix-service = "2" actix-utils = "3" - tracing = "0.1.35" tracing-futures = "0.2" [dev-dependencies] actix-rt = "2" slab = "0.4" + +[lints] +workspace = true diff --git a/actix-tracing/src/lib.rs b/actix-tracing/src/lib.rs index 4107b429..f110ccbe 100644 --- a/actix-tracing/src/lib.rs +++ b/actix-tracing/src/lib.rs @@ -1,7 +1,5 @@ //! Actix tracing - support for tokio tracing with Actix services. -#![deny(rust_2018_idioms, nonstandard_style)] -#![warn(future_incompatible)] #![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")] @@ -22,6 +20,7 @@ pub struct TracingService { } impl TracingService { + /// Constructs new tracing middleware. pub fn new(inner: S, make_span: F) -> Self { TracingService { inner, make_span } } @@ -63,6 +62,7 @@ pub struct TracingTransform { } impl TracingTransform { + /// Constructs new tracing middleware. pub fn new(make_span: F) -> Self { TracingTransform { make_span, diff --git a/actix-utils/Cargo.toml b/actix-utils/Cargo.toml index e3c2553f..83340f52 100644 --- a/actix-utils/Cargo.toml +++ b/actix-utils/Cargo.toml @@ -1,10 +1,7 @@ [package] name = "actix-utils" version = "3.0.1" -authors = [ - "Nikolay Kim ", - "Rob Ede ", -] +authors = ["Nikolay Kim ", "Rob Ede "] description = "Various utilities used in the Actix ecosystem" keywords = ["network", "framework", "async", "futures"] categories = ["network-programming", "asynchronous"] @@ -14,10 +11,13 @@ edition.workspace = true rust-version.workspace = true [dependencies] -pin-project-lite = "0.2" local-waker = "0.1" +pin-project-lite = "0.2" [dev-dependencies] actix-rt = "2" futures-util = { version = "0.3.17", default-features = false } static_assertions = "1.1" + +[lints] +workspace = true diff --git a/actix-utils/src/lib.rs b/actix-utils/src/lib.rs index b02687cb..5abc75f8 100644 --- a/actix-utils/src/lib.rs +++ b/actix-utils/src/lib.rs @@ -1,7 +1,5 @@ //! Various utilities used in the Actix ecosystem. -#![deny(rust_2018_idioms, nonstandard_style)] -#![warn(future_incompatible, missing_docs)] #![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")] diff --git a/bytestring/Cargo.toml b/bytestring/Cargo.toml index 067a7fbe..a7b92d7c 100644 --- a/bytestring/Cargo.toml +++ b/bytestring/Cargo.toml @@ -2,10 +2,7 @@ name = "bytestring" version = "1.4.0" description = "A UTF-8 encoded read-only string using `Bytes` as storage" -authors = [ - "Nikolay Kim ", - "Rob Ede ", -] +authors = ["Nikolay Kim ", "Rob Ede "] keywords = ["string", "bytes", "utf8", "web", "bytestring"] categories = ["no-std", "web-programming"] homepage = "https://actix.rs" @@ -15,10 +12,7 @@ edition.workspace = true rust-version.workspace = true [package.metadata.cargo_check_external_types] -allowed_external_types = [ - "bytes::*", - "serde::*", -] +allowed_external_types = ["bytes::*", "serde::*"] [dependencies] bytes = { version = "1.2", default-features = false } @@ -28,3 +22,6 @@ serde = { version = "1", optional = true } ahash = { version = "0.8", default-features = false } serde_json = "1" static_assertions = "1.1" + +[lints] +workspace = true diff --git a/bytestring/src/lib.rs b/bytestring/src/lib.rs index 1108c449..d0d05a20 100644 --- a/bytestring/src/lib.rs +++ b/bytestring/src/lib.rs @@ -3,8 +3,6 @@ //! See docs for [`ByteString`]. #![no_std] -#![deny(rust_2018_idioms, nonstandard_style)] -#![warn(future_incompatible, missing_docs)] extern crate alloc; diff --git a/local-channel/Cargo.toml b/local-channel/Cargo.toml index 9577fc2f..466b9a40 100644 --- a/local-channel/Cargo.toml +++ b/local-channel/Cargo.toml @@ -2,10 +2,7 @@ name = "local-channel" version = "0.1.5" description = "A non-threadsafe multi-producer, single-consumer, futures-aware, FIFO queue" -authors = [ - "Nikolay Kim ", - "Rob Ede ", -] +authors = ["Nikolay Kim ", "Rob Ede "] repository = "https://github.com/actix/actix-net" keywords = ["channel", "local", "futures"] license.workspace = true @@ -13,10 +10,7 @@ edition.workspace = true rust-version.workspace = true [package.metadata.cargo_check_external_types] -allowed_external_types = [ - "futures_core::*", - "futures_sink::*", -] +allowed_external_types = ["futures_core::*", "futures_sink::*"] [dependencies] futures-core = "0.3.17" diff --git a/local-waker/Cargo.toml b/local-waker/Cargo.toml index d6f25051..772dea55 100644 --- a/local-waker/Cargo.toml +++ b/local-waker/Cargo.toml @@ -2,10 +2,7 @@ name = "local-waker" version = "0.1.4" description = "A synchronization primitive for thread-local task wakeup" -authors = [ - "Nikolay Kim ", - "Rob Ede ", -] +authors = ["Nikolay Kim ", "Rob Ede "] repository = "https://github.com/actix/actix-net" keywords = ["waker", "local", "futures", "no-std"] categories = ["asynchronous", "no-std"]