From 653be329874646e45af32a9158946fe238366e04 Mon Sep 17 00:00:00 2001 From: 0x676e67 Date: Fri, 14 Mar 2025 12:27:42 +0800 Subject: [PATCH] build(deps): remove unused dependencies --- Cargo.toml | 6 +----- src/async_impl/http.rs | 2 -- src/async_impl/ws/mod.rs | 6 ------ src/dns.rs | 9 +-------- src/lib.rs | 16 ---------------- 5 files changed, 2 insertions(+), 37 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 64565a57..1de4542b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,18 +18,14 @@ doctest = false name = "stub_gen" path = "src/stub_gen.rs" -[features] -logging = ["dep:pyo3-log", "dep:log"] - [dependencies] -tokio = { version = "1.44.0", features = ["sync"] } +tokio = { version = "1.44.1", features = ["sync"] } pyo3 = { version = "0.24.0", features = [ "indexmap", "multiple-pymethods", "generate-import-lib", ] } pyo3-async-runtimes = { version = "0.24.0", features = ["tokio-runtime", "unstable-streams"] } -pyo3-log = { version = "0.12.1", optional = true } pyo3-stub-gen = "0.7.0" log = { version = "0.4", optional = true } serde = { version = "1.0.219", features = ["derive"] } diff --git a/src/async_impl/http.rs b/src/async_impl/http.rs index 14d2e5ef..49ad369c 100644 --- a/src/async_impl/http.rs +++ b/src/async_impl/http.rs @@ -299,8 +299,6 @@ impl Response { /// Closes the response connection. pub fn close(&self, py: Python) -> PyResult<()> { py.allow_threads(|| { - #[cfg(feature = "logging")] - log::debug!("Closing HTTP connection"); let _ = self.inner().map(drop); Ok(()) }) diff --git a/src/async_impl/ws/mod.rs b/src/async_impl/ws/mod.rs index dc959a6f..007b3f89 100644 --- a/src/async_impl/ws/mod.rs +++ b/src/async_impl/ws/mod.rs @@ -90,9 +90,6 @@ impl WebSocket { code: Option, reason: Option, ) -> PyResult<()> { - #[cfg(feature = "logging")] - log::debug!("Closing WebSocket connection"); - let mut lock = receiver.lock().await; let receiver = lock.take(); drop(lock); @@ -115,9 +112,6 @@ impl WebSocket { .map_err(wrap_rquest_error)?; sender.flush().await.map_err(wrap_rquest_error)?; sender.close().await.map_err(wrap_rquest_error)?; - - #[cfg(feature = "logging")] - log::debug!("WebSocket connection closed"); } Ok(()) diff --git a/src/dns.rs b/src/dns.rs index c1f60a6c..322323c6 100644 --- a/src/dns.rs +++ b/src/dns.rs @@ -45,14 +45,7 @@ fn init( HickoryDnsResolver::new(strategy.into_ffi()) .map(Arc::new) .map_err(|err| { - #[cfg(feature = "logging")] - { - log::error!("failed to initialize the DNS resolver: {}", err); - } - #[cfg(not(feature = "logging"))] - { - eprintln!("failed to initialize the DNS resolver: {}", err); - } + eprintln!("failed to initialize the DNS resolver: {}", err); "failed to initialize the DNS resolver" }) }) diff --git a/src/lib.rs b/src/lib.rs index a035632c..e8c55332 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,13 +9,9 @@ mod typing; use async_impl::{Client, Message, Response, Streamer, WebSocket}; use blocking::{BlockingClient, BlockingResponse, BlockingStreamer, BlockingWebSocket}; -#[cfg(feature = "logging")] -use log::LevelFilter; use param::{RequestParams, WebSocketParams}; use pyo3::{prelude::*, pybacked::PyBackedStr}; use pyo3_async_runtimes::tokio::future_into_py; -#[cfg(feature = "logging")] -use pyo3_log::{Caching, Logger}; use pyo3_stub_gen::{define_stub_info_gatherer, derive::*}; use typing::{ Impersonate, ImpersonateOS, LookupIpStrategy, Method, Multipart, Part, Proxy, SocketAddr, @@ -323,18 +319,6 @@ fn websocket( fn rnet(m: &Bound<'_, PyModule>) -> PyResult<()> { pyo3::prepare_freethreaded_python(); - // A good place to install the Rust -> Python logger. - #[cfg(feature = "logging")] - { - let handle = Logger::new(m.py(), Caching::LoggersAndLevels)? - .filter(LevelFilter::Trace) - .install() - .expect("Someone installed a logger before rnet."); - - // Some time in the future when logging changes, reset the caches: - handle.reset(); - } - m.add_class::()?; m.add_class::()?; m.add_class::()?;