Skip to content

Commit 66bab6b

Browse files
authored
Rollup merge of #102322 - sigaloid:master, r=GuillaumeGomez
Document that Display automatically implements ToString Closes #92941 r? rust-lang/docs
2 parents 0415560 + 4fad063 commit 66bab6b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

library/core/src/fmt/mod.rs

+7
Original file line numberDiff line numberDiff line change
@@ -709,12 +709,19 @@ pub use macros::Debug;
709709

710710
/// Format trait for an empty format, `{}`.
711711
///
712+
/// Implementing this trait for a type will automatically implement the
713+
/// [`ToString`][tostring] trait for the type, allowing the usage
714+
/// of the [`.to_string()`][tostring_function] method. Prefer implementing
715+
/// the `Display` trait for a type, rather than [`ToString`][tostring].
716+
///
712717
/// `Display` is similar to [`Debug`], but `Display` is for user-facing
713718
/// output, and so cannot be derived.
714719
///
715720
/// For more information on formatters, see [the module-level documentation][module].
716721
///
717722
/// [module]: ../../std/fmt/index.html
723+
/// [tostring]: ../../std/string/trait.ToString.html
724+
/// [tostring_function]: ../../std/string/trait.ToString.html#tymethod.to_string
718725
///
719726
/// # Examples
720727
///

0 commit comments

Comments
 (0)