Skip to content

Various issues with pub(crate) tuple structs containing comments #5011

@cormacrelf

Description

@cormacrelf

These relate specifically to pub(crate) tuple structs. Other vis modifiers are not affected. Only occurs when there is a comment before the first unnamed field.

  • ASlash's comment is deleted
  • AStar gets bonus nonsense
  • BStar is like AStar but on one line
pub(crate) struct ASlash(
    // hello
    i32
);
// output:
// pub(crate) struct ASlash(i32);

pub(crate) struct AStar(
    /* hello */
    i32
);
// output:
// pub(crate) struct AStar(
//     crate) struct AStar(
//     /* hello */
//     i32,
// );

pub(crate) struct BStar(/* hello */ i32);
// output:
// pub(crate) struct BStar(crate) struct BStar(/* hello */ i32);

Tested on rustfmt 1.4.37-stable (c8dfcfe0 2021-09-06)

Similar to #919, but those structs were empty, but these ones have fields.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-commentsArea: commentsE-help-wantedCall for participation: help is requested to fix this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions