Skip to content

Commit 0e90cea

Browse files
Itertools::format[_with] docs mention it can panic if used in logging macros
1 parent 4777762 commit 0e90cea

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/lib.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -2319,6 +2319,8 @@ pub trait Itertools: Iterator {
23192319
/// with `sep` inserted between each element.
23202320
///
23212321
/// **Panics** if the formatter helper is formatted more than once.
2322+
/// ⚠ This can happen discreetly and be hard to debug if used in
2323+
/// _macros of some logging frameworks_ like `tracing`! ⚠
23222324
///
23232325
/// ```
23242326
/// use itertools::Itertools;
@@ -2339,15 +2341,17 @@ pub trait Itertools: Iterator {
23392341
///
23402342
/// This is a customizable version of [`.format()`](Itertools::format).
23412343
///
2344+
/// **Panics** if the formatter helper is formatted more than once.
2345+
/// ⚠ This can happen discreetly and be hard to debug if used in
2346+
/// _macros of some logging frameworks_ like `tracing`! ⚠
2347+
///
23422348
/// The supplied closure `format` is called once per iterator element,
23432349
/// with two arguments: the element and a callback that takes a
23442350
/// `&Display` value, i.e. any reference to type that implements `Display`.
23452351
///
23462352
/// Using `&format_args!(...)` is the most versatile way to apply custom
23472353
/// element formatting. The callback can be called multiple times if needed.
23482354
///
2349-
/// **Panics** if the formatter helper is formatted more than once.
2350-
///
23512355
/// ```
23522356
/// use itertools::Itertools;
23532357
///

0 commit comments

Comments
 (0)