Skip to content

Commit

Permalink
Itertools::format[_with] docs mention it can panic if used in loggi…
Browse files Browse the repository at this point in the history
…ng macros
  • Loading branch information
Philippe-Cholet committed May 21, 2024
1 parent 4777762 commit 86b586f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2319,6 +2319,8 @@ pub trait Itertools: Iterator {
/// with `sep` inserted between each element.
///
/// **Panics** if the formatter helper is formatted more than once.
/// ⚠ This can happen unexpectedly and be hard to debug if used in
/// _macros of some logging frameworks_ like `tracing`! ⚠
///
/// ```
/// use itertools::Itertools;
Expand All @@ -2339,15 +2341,17 @@ pub trait Itertools: Iterator {
///
/// This is a customizable version of [`.format()`](Itertools::format).
///
/// **Panics** if the formatter helper is formatted more than once.
/// ⚠ This can happen unexpectedly and be hard to debug if used in
/// _macros of some logging frameworks_ like `tracing`! ⚠
///
/// The supplied closure `format` is called once per iterator element,
/// with two arguments: the element and a callback that takes a
/// `&Display` value, i.e. any reference to type that implements `Display`.
///
/// Using `&format_args!(...)` is the most versatile way to apply custom
/// element formatting. The callback can be called multiple times if needed.
///
/// **Panics** if the formatter helper is formatted more than once.
///
/// ```
/// use itertools::Itertools;
///
Expand Down

0 comments on commit 86b586f

Please sign in to comment.