Skip to content

Block comment removed from function signature when using unit #6667

@funnyboy-roks

Description

@funnyboy-roks

When I write a function like one of the following

fn foo() -> (/* some comment */) {}
fn bar(x: (/* some comment */)) {}
fn baz() -> Result<(/* some comment */), ()> {}

The comment inside the unit in the return/parameter type gets removed:

fn foo() -> () {}
fn bar(x: ()) {}
fn baz() -> Result<(), ()> {}

This does not happen inside of the function body itself:

fn qux() {
    (/* comment */) // this is fine
}

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