File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -3385,7 +3385,12 @@ declare_clippy_lint! {
3385
3385
///
3386
3386
/// ### Why is this bad?
3387
3387
/// This allocates a new string for every element in the iterator.
3388
- /// This can be done more efficiently by creating the `String` once and appending to it using `Iterator::fold`.
3388
+ /// This can be done more efficiently by creating the `String` once and appending to it in `Iterator::fold`,
3389
+ /// using either the `write!` macro which supports exactly the same syntax as the `format!` macro,
3390
+ /// or concatenating with `+` in case the iterator yields `&str`/`String`.
3391
+ ///
3392
+ /// Note also that `write!`-ing into a `String` can never fail, despite the return type of `write!` being `std::fmt::Result`,
3393
+ /// so it can be safely ignored or unwrapped.
3389
3394
///
3390
3395
/// ### Example
3391
3396
/// ```rust
You can’t perform that action at this time.
0 commit comments