Skip to content

Dealing with comments, and more specifically, around keywordsΒ #191

Open
@fee1-dead

Description

@fee1-dead

There's a rustfmt PR that I started a while ago that hasn't received much traction since it was marked blocked pending t-style's decision. To my understanding, there have been these concerns:

  • Are there places for comments that should be discouraged or disallowed by the style guide?
  • If the answer to the first question is "Yes", then should an automatic formatter delete those comments by default, provide a warning, or keep it without warning?
  • If the placement of certain comments are neither explicitly encouraged or discouraged, should an automatic formatter delete or keep those comments by default?

This has been discussed on Zulip previously. AFAIK there were no "official" decisions that came out of the discussion, so I'd like to formally raise an issue here.

I realize that some of these questions above feel somewhat out of scope, and I just wanted to make it clear that "this is not within the scope of t-style" is a totally appropriate response. I really just want to unblock my PR, since it is really elegant..

Here's also a small example:

pub // a
macro // b
hi(
    // c
) {
    // d
}

macro_rules! // a
my_macro {
    () => {};
}

Is currently formatted by rustfmt as:

pub macro hi(
    // c
) {
    // d
}

macro_rules! my_macro {
    () => {};
}

Deleting the comments. cc @rust-lang/rustfmt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions