Skip formatting for some compiler documentation code

These examples feature Rust code that's presented primarily to
illustrate how its compilation would be handled, and these examples are
formatted to highlight those aspects in ways that rustfmt wouldn't
preserve. Turn formatting off in those examples.

(Doc code isn't formatted yet, but this will make it easier to enable
doc code formatting in the future.)
This commit is contained in:
Josh Triplett
2025-07-25 17:27:08 -07:00
parent 29a58723b0
commit 3352dfc4a2
3 changed files with 5 additions and 2 deletions
@@ -417,7 +417,7 @@ pub(crate) fn new(
/// minimum values.
///
/// For example:
/// ```
/// ```ignore (illustrative)
/// fn foo<'a, 'b>( /* ... */ ) where 'a: 'b { /* ... */ }
/// ```
/// would initialize two variables like so:
+1 -1
View File
@@ -356,7 +356,7 @@ pub fn has_codegen_attrs(self) -> bool {
/// For example, everything prefixed with `/* Res */` in this example has
/// an associated `Res`:
///
/// ```
/// ```ignore (illustrative)
/// fn str_to_string(s: & /* Res */ str) -> /* Res */ String {
/// /* Res */ String::from(/* Res */ s)
/// }
@@ -108,6 +108,7 @@ fn new(
///
/// ```rust
/// struct S;
/// #[rustfmt::skip]
/// fn foo(pred: bool) { // maybe-init:
/// // {}
/// let a = S; let mut b = S; let c; let d; // {a, b}
@@ -197,6 +198,7 @@ fn move_data(&self) -> &MoveData<'tcx> {
///
/// ```rust
/// struct S;
/// #[rustfmt::skip]
/// fn foo(pred: bool) { // maybe-uninit:
/// // {a, b, c, d}
/// let a = S; let mut b = S; let c; let d; // { c, d}
@@ -289,6 +291,7 @@ fn move_data(&self) -> &MoveData<'tcx> {
///
/// ```rust
/// struct S;
/// #[rustfmt::skip]
/// fn foo(pred: bool) { // ever-init:
/// // { }
/// let a = S; let mut b = S; let c; let d; // {a, b }