Skip to content

Commit 5000d62

Browse files
committed
Add #![rustfmt::skip] to 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.)
1 parent 29a5872 commit 5000d62

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

compiler/rustc_borrowck/src/region_infer/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
418418
///
419419
/// For example:
420420
/// ```
421+
/// #![rustfmt::skip]
421422
/// fn foo<'a, 'b>( /* ... */ ) where 'a: 'b { /* ... */ }
422423
/// ```
423424
/// would initialize two variables like so:

compiler/rustc_hir/src/def.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ impl DefKind {
357357
/// an associated `Res`:
358358
///
359359
/// ```
360+
/// #![rustfmt::skip]
360361
/// fn str_to_string(s: & /* Res */ str) -> /* Res */ String {
361362
/// /* Res */ String::from(/* Res */ s)
362363
/// }

compiler/rustc_mir_dataflow/src/impls/initialized.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ impl<'tcx> MaybePlacesSwitchIntData<'tcx> {
107107
/// dataflow information shown in the right-hand comments.
108108
///
109109
/// ```rust
110+
/// #![rustfmt::skip]
110111
/// struct S;
111112
/// fn foo(pred: bool) { // maybe-init:
112113
/// // {}
@@ -196,6 +197,7 @@ impl<'a, 'tcx> HasMoveData<'tcx> for MaybeInitializedPlaces<'a, 'tcx> {
196197
/// dataflow information shown in the right-hand comments.
197198
///
198199
/// ```rust
200+
/// #![rustfmt::skip]
199201
/// struct S;
200202
/// fn foo(pred: bool) { // maybe-uninit:
201203
/// // {a, b, c, d}
@@ -288,6 +290,7 @@ impl<'tcx> HasMoveData<'tcx> for MaybeUninitializedPlaces<'_, 'tcx> {
288290
/// dataflow information shown in the right-hand comments.
289291
///
290292
/// ```rust
293+
/// #![rustfmt::skip]
291294
/// struct S;
292295
/// fn foo(pred: bool) { // ever-init:
293296
/// // { }

0 commit comments

Comments
 (0)