Skip to content

Trying to skip formatting in doc comments #5623

Open
@AaronKutch

Description

@AaronKutch

In a recent nightly, rustfmt with format_code_in_doc_comments = true started working and fixed some stuff. However, there was a place where I wanted to skip the formatting. This code:

/// ```
/// #![rustfmt::skip]
/// use core::primitive;
///
/// let y = 0;
/// ```
fn main() {}

will result in

error[internal]: left behind trailing whitespace
  --> \\?\C:\Users\aaron\Documents\github\testbin\src\main.rs:11:11:4
   |
11 | ///
   |    ^^^^^

I presume the above behavior is a bug.
Independently, is there a way of skipping doc formatting without #![rustfmt::skip] appearing? I feel like I've seen some tag you can attach to the triple backticks, but it is not documented prominently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a-commentse-trailing whitespaceerror[internal]: left behind trailing whitespaceonly-with-optionrequires a non-default option value to reproduce

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions