about summary refs log tree commit diff
path: root/library/core/src/macros/mod.rs
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2025-08-02 11:24:24 +0200
committerGitHub <noreply@github.com>2025-08-02 11:24:24 +0200
commitd082ff4c04c09e855d7ea55e0c9deda05eba46ec (patch)
treec0b95c7bf6b389d2fa07dea65c5fe427c153de73 /library/core/src/macros/mod.rs
parentcafd9fb2d3f2b5179308f3c736341fa9cec61867 (diff)
parent1e2d58798fab4aa6275acf3746e1aec5340fc97f (diff)
downloadrust-d082ff4c04c09e855d7ea55e0c9deda05eba46ec.tar.gz
rust-d082ff4c04c09e855d7ea55e0c9deda05eba46ec.zip
Rollup merge of #144478 - joshtriplett:doc-code-formatting-prep, r=Amanieu
Improve formatting of doc code blocks

We don't currently apply automatic formatting to doc comment code blocks. As a
result, it has built up various idiosyncracies, which make such automatic
formatting difficult. Some of those idiosyncracies also make things harder for
human readers or other tools.

This PR makes a few improvements to doc code formatting, in the hopes of making
future automatic formatting easier, as well as in many cases providing net
readability improvements.

I would suggest reading each commit separately, as each commit contains one
class of changes.
Diffstat (limited to 'library/core/src/macros/mod.rs')
-rw-r--r--library/core/src/macros/mod.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs
index 3d57da63683..c59290a757b 100644
--- a/library/core/src/macros/mod.rs
+++ b/library/core/src/macros/mod.rs
@@ -271,7 +271,10 @@ pub macro cfg_select($($tt:tt)*) {
 /// // expression given.
 /// debug_assert!(true);
 ///
-/// fn some_expensive_computation() -> bool { true } // a very simple function
+/// fn some_expensive_computation() -> bool {
+///     // Some expensive computation here
+///     true
+/// }
 /// debug_assert!(some_expensive_computation());
 ///
 /// // assert with a custom message
@@ -1547,7 +1550,10 @@ pub(crate) mod builtin {
     /// // expression given.
     /// assert!(true);
     ///
-    /// fn some_computation() -> bool { true } // a very simple function
+    /// fn some_computation() -> bool {
+    ///     // Some expensive computation here
+    ///     true
+    /// }
     ///
     /// assert!(some_computation());
     ///