diff --git a/Cargo.lock b/Cargo.lock index bedd74222..d5e2615ef 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -867,13 +867,9 @@ dependencies = [ name = "conduwuit" version = "26.9.1" dependencies = [ - "aws-lc-rs", "clap", - "conduwuit_admin", - "conduwuit_api", "conduwuit_build_metadata", "conduwuit_core", - "conduwuit_database", "conduwuit_macros", "conduwuit_router", "conduwuit_service", @@ -881,8 +877,6 @@ dependencies = [ "const-str", "ctor", "dtor", - "hardened_malloc-rs", - "log", "opentelemetry", "opentelemetry-otlp", "opentelemetry-prometheus", @@ -890,13 +884,10 @@ dependencies = [ "opentelemetry_sdk", "parking_lot", "prometheus", - "reqwest 0.13.5", "rustls", "sentry", - "sentry-tower", "sentry-tracing", "tokio", - "tokio-metrics", "tracing", "tracing-flame", "tracing-journald", @@ -919,7 +910,6 @@ dependencies = [ "dtor", "futures", "lettre", - "log", "resolvematrix", "ruma", "serde-saphyr", @@ -950,7 +940,6 @@ dependencies = [ "hyper", "itertools 0.15.0", "lettre", - "log", "rand 0.10.3", "reqwest 0.13.5", "ruma", @@ -1004,7 +993,6 @@ dependencies = [ "libc", "libloading 0.9.0", "lock_api 0.5.0", - "log", "maplit", "nix", "num-traits", @@ -1052,7 +1040,6 @@ dependencies = [ "ctor", "dtor", "futures", - "log", "minicbor", "minicbor-serde", "rust-rocksdb", @@ -1094,14 +1081,10 @@ dependencies = [ "http-body-util", "hyper", "hyper-util", - "log", "opentelemetry-instrumentation-tower", "ruma", - "rustls", "sd-notify", - "sentry", "sentry-tower", - "sentry-tracing", "serde_json", "tokio", "tower", diff --git a/Cargo.toml b/Cargo.toml index fa8b5aa5f..43a9efa85 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1020,4 +1020,7 @@ collapsible_if = "allow" cognitive_complexity = "allow" [workspace.metadata.cargo-shear] -ignored = ["const-str", "ctor", "dtor"] +# All of these crates provide macros that are used across the codebase +# and that every crate depends on. cargo-shear can't tell this because +# it doesn't expand macros. +ignored = ["const-str", "ctor", "dtor", "tracing"] diff --git a/src/admin/Cargo.toml b/src/admin/Cargo.toml index 6495ad400..446276ff0 100644 --- a/src/admin/Cargo.toml +++ b/src/admin/Cargo.toml @@ -62,8 +62,6 @@ release_max_log_level = [ "conduwuit-service/release_max_log_level", "tracing/max_level_trace", "tracing/release_max_level_info", - "log/max_level_trace", - "log/release_max_level_info", ] zstd_compression = [ "conduwuit-api/zstd_compression", @@ -84,7 +82,6 @@ ctor.workspace = true dtor.workspace = true futures.workspace = true lettre.workspace = true -log.workspace = true ruma.workspace = true serde_json.workspace = true serde-saphyr.workspace = true diff --git a/src/api/Cargo.toml b/src/api/Cargo.toml index 4385fbe7f..329d934c4 100644 --- a/src/api/Cargo.toml +++ b/src/api/Cargo.toml @@ -51,8 +51,6 @@ jemalloc_stats = [ release_max_log_level = [ "conduwuit-core/release_max_log_level", "conduwuit-service/release_max_log_level", - "log/max_level_trace", - "log/release_max_level_info", "tracing/max_level_trace", "tracing/release_max_level_info", ] @@ -80,7 +78,6 @@ http-body-util.workspace = true hyper.workspace = true itertools.workspace = true lettre.workspace = true -log.workspace = true rand.workspace = true reqwest.workspace = true ruma.workspace = true diff --git a/src/core/Cargo.toml b/src/core/Cargo.toml index ca4071ae8..335ba023a 100644 --- a/src/core/Cargo.toml +++ b/src/core/Cargo.toml @@ -47,8 +47,6 @@ perf_measurements = [] release_max_log_level = [ "tracing/max_level_trace", "tracing/release_max_level_info", - "log/max_level_trace", - "log/release_max_level_info", ] sentry_telemetry = [] zstd_compression = [ @@ -84,7 +82,6 @@ ipaddress.workspace = true libc.workspace = true libloading.workspace = true libloading.optional = true -log.workspace = true lettre.workspace = true num-traits.workspace = true rand.workspace = true diff --git a/src/core/utils/result/inspect_log.rs b/src/core/utils/result/inspect_log.rs deleted file mode 100644 index e9f32663c..000000000 --- a/src/core/utils/result/inspect_log.rs +++ /dev/null @@ -1,62 +0,0 @@ -use std::fmt; - -use tracing::Level; - -use super::Result; -use crate::error; - -pub trait ErrLog -where - E: fmt::Display, -{ - fn log_err(self, level: Level) -> Self; - - #[inline] - fn err_log(self) -> Self - where - Self: Sized, - { - self.log_err(Level::ERROR) - } -} - -pub trait ErrDebugLog -where - E: fmt::Debug, -{ - fn log_err_debug(self, level: Level) -> Self; - - #[inline] - fn err_debug_log(self) -> Self - where - Self: Sized, - { - self.log_err_debug(Level::ERROR) - } -} - -impl ErrLog for Result -where - E: fmt::Display, -{ - #[inline] - fn log_err(self, level: Level) -> Self - where - Self: Sized, - { - self.inspect_err(|error| error::inspect_log_level(&error, level)) - } -} - -impl ErrDebugLog for Result -where - E: fmt::Debug, -{ - #[inline] - fn log_err_debug(self, level: Level) -> Self - where - Self: Sized, - { - self.inspect_err(|error| error::inspect_debug_log_level(&error, level)) - } -} diff --git a/src/database/Cargo.toml b/src/database/Cargo.toml index 6b04c624d..8512c1362 100644 --- a/src/database/Cargo.toml +++ b/src/database/Cargo.toml @@ -34,8 +34,6 @@ jemalloc_stats = [ ] release_max_log_level = [ "conduwuit-core/release_max_log_level", - "log/max_level_trace", - "log/release_max_level_info", "tracing/max_level_trace", "tracing/release_max_level_info", ] @@ -60,7 +58,6 @@ const-str.workspace = true ctor.workspace = true dtor.workspace = true futures.workspace = true -log.workspace = true minicbor.workspace = true minicbor-serde.workspace = true rust-rocksdb.workspace = true diff --git a/src/main/Cargo.toml b/src/main/Cargo.toml index 8cc5c2975..18cc054a7 100644 --- a/src/main/Cargo.toml +++ b/src/main/Cargo.toml @@ -77,7 +77,6 @@ full = [ ] brotli_compression = [ - "conduwuit-api/brotli_compression", "conduwuit-core/brotli_compression", "conduwuit-router/brotli_compression", "conduwuit-service/brotli_compression", @@ -89,11 +88,10 @@ direct_tls = [ "conduwuit-router/direct_tls" ] element_hacks = [ - "conduwuit-api/element_hacks", "conduwuit-service/element_hacks", + "conduwuit-router/element_hacks", ] gzip_compression = [ - "conduwuit-api/gzip_compression", "conduwuit-core/gzip_compression", "conduwuit-router/gzip_compression", "conduwuit-service/gzip_compression", @@ -102,7 +100,7 @@ hardened_malloc = [ "conduwuit-core/hardened_malloc", ] http3 = [ - "reqwest/http3" + "conduwuit-service/http3" ] ring = [ "rustls/ring", @@ -110,14 +108,13 @@ ring = [ aws_lc_rs = [ "rustls/aws_lc_rs", - "dep:aws-lc-rs", ] io_uring = [ - "conduwuit-database/io_uring", + "conduwuit-service/io_uring", ] jemalloc = [ "conduwuit-core/jemalloc", - "conduwuit-database/jemalloc", + "conduwuit-service/jemalloc", ] jemalloc_prof = [ "conduwuit-core/jemalloc_prof", @@ -146,19 +143,13 @@ perf_measurements = [ release_max_log_level = [ "tracing/max_level_trace", "tracing/release_max_level_info", - "log/max_level_trace", - "log/release_max_level_info", - "conduwuit-admin/release_max_log_level", - "conduwuit-api/release_max_log_level", "conduwuit-core/release_max_log_level", - "conduwuit-database/release_max_log_level", "conduwuit-router/release_max_log_level", "conduwuit-service/release_max_log_level", ] sentry_telemetry = [ "dep:sentry", "dep:sentry-tracing", - "dep:sentry-tower", "conduwuit-core/sentry_telemetry", "conduwuit-router/sentry_telemetry", ] @@ -181,9 +172,7 @@ url_preview = [ "conduwuit-service/url_preview", ] zstd_compression = [ - "conduwuit-api/zstd_compression", "conduwuit-core/zstd_compression", - "conduwuit-database/zstd_compression", "conduwuit-router/zstd_compression", "conduwuit-service/zstd_compression", ] @@ -193,10 +182,10 @@ conduwuit_mods = [ bindgen-static = [ # "bindgen/static" # "clang-sys/static" - "conduwuit-database/bindgen-static" + "conduwuit-service/bindgen-static" ] bindgen-runtime = [ - "conduwuit-database/bindgen-runtime" + "conduwuit-service/bindgen-runtime" ] [build-dependencies] @@ -204,10 +193,7 @@ bindgen-runtime = [ # clang-sys = {version = "1", default-features = false} [dependencies] -conduwuit-admin.workspace = true -conduwuit-api.workspace = true conduwuit-core.workspace = true -conduwuit-database.workspace = true conduwuit-router.workspace = true conduwuit-service.workspace = true conduwuit-build-metadata.workspace = true @@ -219,7 +205,6 @@ dtor.workspace = true console-subscriber.optional = true console-subscriber.workspace = true const-str.workspace = true -log.workspace = true opentelemetry.workspace = true opentelemetry-otlp.optional = true opentelemetry-otlp.workspace = true @@ -227,14 +212,10 @@ opentelemetry-prometheus.workspace = true opentelemetry-semantic-conventions.workspace = true opentelemetry_sdk.workspace = true prometheus.workspace = true -sentry-tower.optional = true -sentry-tower.workspace = true sentry-tracing.optional = true sentry-tracing.workspace = true sentry.optional = true sentry.workspace = true -tokio-metrics.optional = true -tokio-metrics.workspace = true tokio.workspace = true tracing-flame.optional = true tracing-flame.workspace = true @@ -244,14 +225,7 @@ tracing-subscriber.workspace = true tracing.workspace = true tracing-journald = { workspace = true, optional = true } parking_lot.workspace = true -reqwest = { workspace = true, default-features = false } rustls = { workspace = true, default-features = false } -aws-lc-rs = { version = "1.19.0", default-features = false, optional = true } - - -[target.'cfg(all(not(target_env = "msvc"), target_os = "linux"))'.dependencies] -hardened_malloc-rs.workspace = true -hardened_malloc-rs.optional = true [lints] workspace = true diff --git a/src/router/Cargo.toml b/src/router/Cargo.toml index e1e66373a..aa0bc9aca 100644 --- a/src/router/Cargo.toml +++ b/src/router/Cargo.toml @@ -25,9 +25,11 @@ brotli_compression = [ ] direct_tls = [ "axum-server/tls-rustls-no-provider", - "dep:rustls", "dep:axum-server-dual-protocol", ] +element_hacks = [ + "conduwuit-api/element_hacks", +] gzip_compression = [ "conduwuit-admin/gzip_compression", "conduwuit-api/gzip_compression", @@ -71,13 +73,9 @@ release_max_log_level = [ "conduwuit-service/release_max_log_level", "tracing/max_level_trace", "tracing/release_max_level_info", - "log/max_level_trace", - "log/release_max_level_info", ] sentry_telemetry = [ "conduwuit-core/sentry_telemetry", - "dep:sentry", - "dep:sentry-tracing", "dep:sentry-tower", ] systemd = [ @@ -110,17 +108,9 @@ http.workspace = true http-body-util.workspace = true hyper.workspace = true hyper-util.workspace = true -log.workspace = true opentelemetry-instrumentation-tower.workspace = true ruma.workspace = true -rustls.workspace = true -rustls.optional = true -sentry.optional = true -sentry.workspace = true -sentry-tower.optional = true -sentry-tower.workspace = true -sentry-tracing.optional = true -sentry-tracing.workspace = true +sentry-tower = { workspace = true, optional = true } serde_json.workspace = true tokio.workspace = true tower.workspace = true diff --git a/src/service/Cargo.toml b/src/service/Cargo.toml index 6ff782c69..f35a40aaa 100644 --- a/src/service/Cargo.toml +++ b/src/service/Cargo.toml @@ -16,6 +16,12 @@ crate-type = [ ] [features] +bindgen-runtime = [ + "conduwuit-database/bindgen-runtime" +] +bindgen-static = [ + "conduwuit-database/bindgen-static" +] brotli_compression = [ "conduwuit-core/brotli_compression", "reqwest/brotli", @@ -29,6 +35,9 @@ gzip_compression = [ "conduwuit-core/gzip_compression", "reqwest/gzip", ] +http3 = [ + "reqwest/http3" +] io_uring = [ "conduwuit-database/io_uring", ] @@ -122,7 +131,8 @@ lettre.workspace = true resolvematrix.workspace = true serde_urlencoded.workspace = true openidconnect.workspace = true -# This is here to set features on the outdated openidconnect reqwest +# We use this to set TLS backend features on the outdated reqwest bundled by openidconnect, +# which is necessary to call `danger_accept_invalid_certs`. reqwest_0_12.workspace = true rand.workspace = true @@ -132,3 +142,6 @@ sd-notify.optional = true [lints] workspace = true + +[package.metadata.cargo-shear] +ignored = ["reqwest_0_12"] diff --git a/src/web/Cargo.toml b/src/web/Cargo.toml index 6b5d6c71c..dd7187de9 100644 --- a/src/web/Cargo.toml +++ b/src/web/Cargo.toml @@ -54,11 +54,11 @@ memory-serve = "2.4.0" workspace = true [package.metadata.cargo-shear] +# All of these dependencies are only used in Askama templates, +# which are transformed into Rust by a proc macro. +# cargo-shear can't see them because it doesn't expand macros. ignored = [ "conduwuit_build_metadata", "form_urlencoded", - "reqwest_recaptcha", "serde_json", - "tower-sessions-core", - "tracing", ] diff --git a/src/web/mod.rs b/src/web/mod.rs index 43dab6746..5593ac017 100644 --- a/src/web/mod.rs +++ b/src/web/mod.rs @@ -11,7 +11,8 @@ use axum::{ use conduwuit_service::{Services, state}; use tower_http::catch_panic::CatchPanicLayer; use tower_sec_fetch::SecFetchLayer; -use tower_sessions::{ExpiredDeletion, SessionManagerLayer, cookie::SameSite}; +use tower_sessions::{SessionManagerLayer, cookie::SameSite}; +use tower_sessions_core::ExpiredDeletion; use crate::{ pages::TemplateContext, diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index 8309f1937..bbd903840 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -18,3 +18,8 @@ cargo_metadata = "0.23.1" [lints] workspace = true + +[package.metadata.cargo-shear] +# Task modules are linked by a macro that cargo-shear doesn't expand, +# so we tell it to ignore them specifically. +ignored-paths = ["src/tasks/*/mod.rs"]