Skip to content

Handle function-like attribute macros with generic types in them #6680

@twiby

Description

@twiby

When using an attribute macro with a function-like syntax:

#[my_macro(Item1, Item2, Item3)]
fn my_fun() {}

rust fmt can give up if the arguments to the macro are types with generic parameters. If the macro line is too long and should be rewritten in several lines, rust fmt doesn't handle the situation at all:

#[my_macro(Item1<u32>, Item2<u32>, Item3<u32>, Item4<u32>, Item5<u32>, Item6<u32>)]
fn my_fun() {}

Workaround: using an alias for those types to not have to write generic parameters in the macro arguments.

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