From ae430be051e41c8ce2034f1c4bf8fc1d4509a275 Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Sun, 2 Oct 2022 00:34:14 +0400 Subject: [PATCH] Remove some previously deprecated items Former-commit-id: 044e87a98519d7f0319d636f450ec8c686bfeb6a --- CHANGELOG.md | 3 ++ src/dispatching.rs | 3 -- src/dispatching/handler_ext.rs | 18 ---------- src/dispatching/handler_factory.rs | 11 ------- src/lib.rs | 2 -- src/logging.rs | 53 ------------------------------ 6 files changed, 3 insertions(+), 87 deletions(-) delete mode 100644 src/dispatching/handler_factory.rs delete mode 100644 src/logging.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index c4995282..8bfe7543 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - `dispatching::stop_token::StopToken` trait (all uses are replaced with `stop::StopToken` structure) +- Some previously deprecated items + - `enable_logging!`, `enable_logging_with_filter!` + - `HandlerFactory`, `HandlerExt::dispatch_by` ## 0.10.1 - 2022-07-22 diff --git a/src/dispatching.rs b/src/dispatching.rs index e9166c74..23a03268 100644 --- a/src/dispatching.rs +++ b/src/dispatching.rs @@ -218,7 +218,6 @@ mod distribution; mod filter_ext; mod handler_description; mod handler_ext; -mod handler_factory; pub mod update_listeners; pub use crate::utils::shutdown_token::{IdleShutdownError, ShutdownToken}; @@ -227,5 +226,3 @@ pub use distribution::DefaultKey; pub use filter_ext::{MessageFilterExt, UpdateFilterExt}; pub use handler_description::DpHandlerDescription; pub use handler_ext::{filter_command, HandlerExt}; -#[allow(deprecated)] -pub use handler_factory::HandlerFactory; diff --git a/src/dispatching/handler_ext.rs b/src/dispatching/handler_ext.rs index 11ebc6bf..a6e80f0c 100644 --- a/src/dispatching/handler_ext.rs +++ b/src/dispatching/handler_ext.rs @@ -8,9 +8,6 @@ use crate::{ }; use dptree::{di::DependencyMap, Handler}; -#[allow(deprecated)] -use crate::dispatching::HandlerFactory; - use std::fmt::Debug; /// Extension methods for working with `dptree` handlers. @@ -51,13 +48,6 @@ pub trait HandlerExt { >::Error: Debug + Send, D: Default + Send + Sync + 'static, Upd: GetChatId + Clone + Send + Sync + 'static; - - #[must_use] - #[deprecated(note = "Use the teloxide::handler! API")] - #[allow(deprecated)] - fn dispatch_by(self) -> Self - where - F: HandlerFactory; } impl HandlerExt for Handler<'static, DependencyMap, Output, DpHandlerDescription> @@ -80,14 +70,6 @@ where { self.chain(super::dialogue::enter::()) } - - #[allow(deprecated)] - fn dispatch_by(self) -> Self - where - F: HandlerFactory, - { - self.chain(F::handler()) - } } /// Returns a handler that accepts a parsed command `C`. diff --git a/src/dispatching/handler_factory.rs b/src/dispatching/handler_factory.rs deleted file mode 100644 index 25122f33..00000000 --- a/src/dispatching/handler_factory.rs +++ /dev/null @@ -1,11 +0,0 @@ -use dptree::{di::DependencyMap, Handler}; - -use crate::dispatching::DpHandlerDescription; - -/// Something that can construct a handler. -#[deprecated(note = "Use the teloxide::handler! API")] -pub trait HandlerFactory { - type Out; - - fn handler() -> Handler<'static, DependencyMap, Self::Out, DpHandlerDescription>; -} diff --git a/src/lib.rs b/src/lib.rs index aad4c98c..c7a2e1a8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -62,8 +62,6 @@ pub use dispatching::repls::{ commands_repl, commands_repl_with_listener, repl, repl_with_listener, }; -mod logging; - pub mod dispatching; pub mod error_handlers; pub mod prelude; diff --git a/src/logging.rs b/src/logging.rs deleted file mode 100644 index 770c17a7..00000000 --- a/src/logging.rs +++ /dev/null @@ -1,53 +0,0 @@ -/// Enables logging through [pretty-env-logger]. -/// -/// A logger will **only** print errors, warnings, and general information from -/// teloxide and **all** logs from your program. -/// -/// # Note -/// -/// Calling this macro **is not mandatory**; you can setup if your own logger if -/// you want. -/// -/// [pretty-env-logger]: https://crates.io/crates/pretty_env_logger -#[macro_export] -#[deprecated = "Choose logging implementation yourself"] -macro_rules! enable_logging { - () => { - #[allow(deprecated)] - teloxide::enable_logging_with_filter!(log::LevelFilter::Trace); - }; -} - -/// Enables logging through [pretty-env-logger] with a custom filter for your -/// program. -/// -/// A logger will **only** print errors, warnings, and general information from -/// teloxide and restrict logs from your program by the specified filter. -/// -/// # Example -/// -/// Allow printing all logs from your program up to [`LevelFilter::Debug`] (i.e. -/// do not print traces): -/// -/// ```no_compile -/// teloxide::enable_logging_with_filter!(log::LevelFilter::Debug); -/// ``` -/// -/// # Note -/// -/// Calling this macro **is not mandatory**; you can setup if your own logger if -/// you want. -/// -/// [pretty-env-logger]: https://crates.io/crates/pretty_env_logger -/// [`LevelFilter::Debug`]: https://docs.rs/log/0.4.10/log/enum.LevelFilter.html -#[macro_export] -#[deprecated = "Choose logging implementation yourself"] -macro_rules! enable_logging_with_filter { - ($filter:expr) => { - pretty_env_logger::formatted_builder() - .write_style(pretty_env_logger::env_logger::WriteStyle::Auto) - .filter(Some(&env!("CARGO_CRATE_NAME").replace("-", "_")), $filter) - .filter(Some("teloxide"), log::LevelFilter::Info) - .init(); - }; -}