From 41e34aded41d9dafda5cda2c5f2f42c5cfc8b279 Mon Sep 17 00:00:00 2001 From: Paul Dicker Date: Sat, 1 Jul 2023 14:30:46 +0200 Subject: [PATCH] Deprecate standalone `format*` functions --- src/format/formatting.rs | 4 ++++ src/format/mod.rs | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/format/formatting.rs b/src/format/formatting.rs index 684e8e92..4e572d54 100644 --- a/src/format/formatting.rs +++ b/src/format/formatting.rs @@ -157,6 +157,7 @@ impl<'a, I: Iterator + Clone, B: Borrow>> Display for Delayed /// Tries to format given arguments with given formatting items. /// Internally used by `DelayedFormat`. #[cfg(any(feature = "alloc", feature = "std"))] +#[deprecated(since = "0.4.32", note = "Use DelayedFormat::fmt instead")] pub fn format<'a, I, B>( w: &mut fmt::Formatter, date: Option<&NaiveDate>, @@ -181,6 +182,7 @@ where /// Formats single formatting item #[cfg(any(feature = "alloc", feature = "std"))] +#[deprecated(since = "0.4.32", note = "Use DelayedFormat::fmt instead")] pub fn format_item( w: &mut fmt::Formatter, date: Option<&NaiveDate>, @@ -202,6 +204,7 @@ pub fn format_item( /// Tries to format given arguments with given formatting items. /// Internally used by `DelayedFormat`. #[cfg(feature = "unstable-locales")] +#[deprecated(since = "0.4.32", note = "Use DelayedFormat::fmt instead")] pub fn format_localized<'a, I, B>( w: &mut fmt::Formatter, date: Option<&NaiveDate>, @@ -226,6 +229,7 @@ where /// Formats single formatting item #[cfg(feature = "unstable-locales")] +#[deprecated(since = "0.4.32", note = "Use DelayedFormat::fmt instead")] pub fn format_item_localized( w: &mut fmt::Formatter, date: Option<&NaiveDate>, diff --git a/src/format/mod.rs b/src/format/mod.rs index 6ee0837e..d5256ab1 100644 --- a/src/format/mod.rs +++ b/src/format/mod.rs @@ -62,8 +62,10 @@ pub(crate) use formatting::write_rfc2822; ))] pub(crate) use formatting::write_rfc3339; #[cfg(any(feature = "alloc", feature = "std"))] +#[allow(deprecated)] pub use formatting::{format, format_item, DelayedFormat}; #[cfg(feature = "unstable-locales")] +#[allow(deprecated)] pub use formatting::{format_item_localized, format_localized}; #[cfg(all(feature = "unstable-locales", any(feature = "alloc", feature = "std")))] pub use locales::Locale;