From 5d35459e700827199a7d843c9c77c6b41f5b8a54 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Fri, 9 May 2025 17:11:13 +0100 Subject: [PATCH] chore: dependabot only does lockfile maintenance --- .github/dependabot.yml | 1 + Cargo.lock | 102 ++++++++++++++++++++++- actix-rt/src/system.rs | 8 +- actix-server/Cargo.toml | 1 + actix-server/examples/shutdown-signal.rs | 20 +++-- actix-server/src/accept.rs | 2 +- actix-server/src/builder.rs | 7 +- actix-server/src/signals.rs | 1 - actix-server/src/worker.rs | 18 ++-- justfile | 1 - 10 files changed, 125 insertions(+), 36 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index b3eb7c8b..3aeae6b1 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,3 +8,4 @@ updates: directory: / schedule: interval: weekly + versioning-strategy: lockfile-only diff --git a/Cargo.lock b/Cargo.lock index 145d6127..1dbca518 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -61,6 +61,7 @@ dependencies = [ "tokio-uring", "tokio-util", "tracing", + "tracing-subscriber", ] [[package]] @@ -1159,6 +1160,15 @@ dependencies = [ "linked-hash-map", ] +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + [[package]] name = "memchr" version = "2.7.4" @@ -1219,6 +1229,16 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "num-conv" version = "0.1.0" @@ -1299,6 +1319,12 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + [[package]] name = "parking_lot" version = "0.12.3" @@ -1543,8 +1569,17 @@ checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", - "regex-automata", - "regex-syntax", + "regex-automata 0.4.9", + "regex-syntax 0.8.5", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", ] [[package]] @@ -1555,9 +1590,15 @@ checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", - "regex-syntax", + "regex-syntax 0.8.5", ] +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + [[package]] name = "regex-syntax" version = "0.8.5" @@ -1891,6 +1932,15 @@ dependencies = [ "serde", ] +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + [[package]] name = "shlex" version = "1.3.0" @@ -2035,6 +2085,16 @@ dependencies = [ "syn", ] +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", +] + [[package]] name = "time" version = "0.3.40" @@ -2296,6 +2356,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", + "valuable", ] [[package]] @@ -2308,6 +2369,35 @@ dependencies = [ "tracing", ] +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + [[package]] name = "trust-dns-proto" version = "0.23.2" @@ -2425,6 +2515,12 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + [[package]] name = "vcpkg" version = "0.2.15" diff --git a/actix-rt/src/system.rs b/actix-rt/src/system.rs index f9fe4c8d..5d8187cd 100644 --- a/actix-rt/src/system.rs +++ b/actix-rt/src/system.rs @@ -187,10 +187,7 @@ impl SystemRunner { match exit_code { 0 => Ok(()), - nonzero => Err(io::Error::new( - io::ErrorKind::Other, - format!("Non-zero exit code: {}", nonzero), - )), + nonzero => Err(io::Error::other(format!("Non-zero exit code: {}", nonzero))), } } @@ -199,8 +196,7 @@ impl SystemRunner { let SystemRunner { rt, stop_rx, .. } = self; // run loop - rt.block_on(stop_rx) - .map_err(|err| io::Error::new(io::ErrorKind::Other, err)) + rt.block_on(stop_rx).map_err(io::Error::other) } /// Retrieves a reference to the underlying [Actix runtime](crate::Runtime) associated with this diff --git a/actix-server/Cargo.toml b/actix-server/Cargo.toml index a6d78e89..5434c2e8 100644 --- a/actix-server/Cargo.toml +++ b/actix-server/Cargo.toml @@ -47,6 +47,7 @@ pretty_env_logger = "0.5" static_assertions = "1" tokio = { version = "1.44.2", features = ["io-util", "rt-multi-thread", "macros", "fs", "time"] } tokio-util = "0.7" +tracing-subscriber = { version = "0.3", features = ["fmt", "env-filter"] } [lints] workspace = true diff --git a/actix-server/examples/shutdown-signal.rs b/actix-server/examples/shutdown-signal.rs index 843b9101..99500845 100644 --- a/actix-server/examples/shutdown-signal.rs +++ b/actix-server/examples/shutdown-signal.rs @@ -8,26 +8,28 @@ use actix_rt::net::TcpStream; use actix_server::Server; use actix_service::fn_service; use tokio_util::sync::CancellationToken; +use tracing::level_filters::LevelFilter; +use tracing_subscriber::{prelude::*, EnvFilter}; async fn run(stop_signal: CancellationToken) -> io::Result<()> { - pretty_env_logger::formatted_timed_builder() - .parse_env(pretty_env_logger::env_logger::Env::default().default_filter_or("info")); + tracing_subscriber::registry() + .with(tracing_subscriber::fmt::layer()) + .with( + EnvFilter::builder() + .with_default_directive(LevelFilter::INFO.into()) + .from_env_lossy(), + ) + .init(); let addr = ("127.0.0.1", 8080); tracing::info!("starting server on port: {}", &addr.0); - // let (tx, rx) = tokio::sync::oneshot::channel::<()>(); - // let (tx, mut rx) = tokio::sync::broadcast::channel::<()>(1); - Server::build() .bind("shutdown-signal", addr, || { fn_service(|_stream: TcpStream| async { Ok::<_, io::Error>(()) }) })? .shutdown_signal(stop_signal.cancelled_owned()) - // .shutdown_signal(async move { - // rx.await; - // // rx.recv().await; - // }) + .workers(2) .run() .await } diff --git a/actix-server/src/accept.rs b/actix-server/src/accept.rs index c250f909..997c9699 100644 --- a/actix-server/src/accept.rs +++ b/actix-server/src/accept.rs @@ -76,7 +76,7 @@ impl Accept { let accept_handle = thread::Builder::new() .name("actix-server acceptor".to_owned()) .spawn(move || accept.poll_with(&mut sockets)) - .map_err(|err| io::Error::new(io::ErrorKind::Other, err))?; + .map_err(io::Error::other)?; Ok((waker_queue, handles_server, accept_handle)) } diff --git a/actix-server/src/builder.rs b/actix-server/src/builder.rs index fac873b6..864132ef 100644 --- a/actix-server/src/builder.rs +++ b/actix-server/src/builder.rs @@ -177,7 +177,7 @@ impl ServerBuilder { /// /// Using this method will prevent OS signal handlers being set up. /// - /// Typically, a `CancellationToken` or `oneshot` / `broadcast` channel will be used. + /// Typically, a `CancellationToken` will be used, but any future _can_ be. /// /// # Examples /// @@ -408,9 +408,6 @@ pub(super) fn bind_addr( } else if let Some(err) = opt_err.take() { Err(err) } else { - Err(io::Error::new( - io::ErrorKind::Other, - "Can not bind to address.", - )) + Err(io::Error::other("Can not bind to address.")) } } diff --git a/actix-server/src/signals.rs b/actix-server/src/signals.rs index 7d01887d..c41d0e33 100644 --- a/actix-server/src/signals.rs +++ b/actix-server/src/signals.rs @@ -57,7 +57,6 @@ impl Future for StopSignal { } /// Process signal listener. -#[derive(Debug)] pub(crate) struct OsSignals { #[cfg(not(unix))] signals: futures_core::future::BoxFuture<'static, std::io::Result<()>>, diff --git a/actix-server/src/worker.rs b/actix-server/src/worker.rs index 7050fcd2..92a2c007 100644 --- a/actix-server/src/worker.rs +++ b/actix-server/src/worker.rs @@ -341,11 +341,10 @@ impl ServerWorker { Ok((token, svc)) => services.push((idx, token, svc)), Err(err) => { - error!("can not start worker: {:?}", err); - return Err(io::Error::new( - io::ErrorKind::Other, - format!("can not start server service {}", idx), - )); + error!("can not start worker: {err:?}"); + return Err(io::Error::other(format!( + "can not start server service {idx}", + ))); } } } @@ -440,13 +439,12 @@ impl ServerWorker { Ok((token, svc)) => services.push((idx, token, svc)), Err(err) => { - error!("can not start worker: {:?}", err); + error!("can not start worker: {err:?}"); Arbiter::current().stop(); factory_tx - .send(Err(io::Error::new( - io::ErrorKind::Other, - format!("can not start server service {}", idx), - ))) + .send(Err(io::Error::other(format!( + "can not start server service {idx}", + )))) .unwrap(); return; } diff --git a/justfile b/justfile index 68be0834..b5b88ced 100644 --- a/justfile +++ b/justfile @@ -41,7 +41,6 @@ non_linux_all_features_list := ``` 'add | unique | . - ($exclusions | split(",")) | join(",")' ``` all_crate_features := if os() == "linux" { "--all-features" } else { "--features='" + non_linux_all_features_list + "'" } - toolchain := "" # Run Clippy over workspace.