]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #102322 - sigaloid:master, r=GuillaumeGomez
authorMichael Howell <michael@notriddle.com>
Mon, 26 Sep 2022 22:40:54 +0000 (15:40 -0700)
committerGitHub <noreply@github.com>
Mon, 26 Sep 2022 22:40:54 +0000 (15:40 -0700)
Document that Display automatically implements ToString

Closes #92941

r? rust-lang/docs

library/core/src/fmt/mod.rs

index 905212eb372b12f8dfe185691abd435563c6deb1..372439f14ec83f769aad80d1f8e47c167945557f 100644 (file)
@@ -709,12 +709,19 @@ pub(crate) mod macros {
 
 /// Format trait for an empty format, `{}`.
 ///
+/// Implementing this trait for a type will automatically implement the
+/// [`ToString`][tostring] trait for the type, allowing the usage
+/// of the [`.to_string()`][tostring_function] method. Prefer implementing
+/// the `Display` trait for a type, rather than [`ToString`][tostring].
+///
 /// `Display` is similar to [`Debug`], but `Display` is for user-facing
 /// output, and so cannot be derived.
 ///
 /// For more information on formatters, see [the module-level documentation][module].
 ///
 /// [module]: ../../std/fmt/index.html
+/// [tostring]: ../../std/string/trait.ToString.html
+/// [tostring_function]: ../../std/string/trait.ToString.html#tymethod.to_string
 ///
 /// # Examples
 ///