Merge pull request #720 from teloxide/remove_deprecated

Remove some previously deprecated items
This commit is contained in:
Waffle Maybe 2022-10-02 06:22:52 +04:00 committed by GitHub
commit a8c225c45c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 3 additions and 87 deletions

View file

@ -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

View file

@ -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;

View file

@ -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<Output> {
<S as Storage<D>>::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<F>(self) -> Self
where
F: HandlerFactory<Out = Output>;
}
impl<Output> HandlerExt<Output> for Handler<'static, DependencyMap, Output, DpHandlerDescription>
@ -80,14 +70,6 @@ where
{
self.chain(super::dialogue::enter::<Upd, S, D, Output>())
}
#[allow(deprecated)]
fn dispatch_by<F>(self) -> Self
where
F: HandlerFactory<Out = Output>,
{
self.chain(F::handler())
}
}
/// Returns a handler that accepts a parsed command `C`.

View file

@ -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>;
}

View file

@ -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;

View file

@ -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();
};
}