Skip to content

Rustfmt can generate invalid code when using space_after_colon=false #6470

@lever1209

Description

@lever1209

formatting the following code with space_after_colon=false will generate invalid code

struct SomeStruct {
    some_field: ::some_crate::Thing,
}

since it removes the space between the field colon and the :: prefix on some_crate
i cant see this as very high priority because i dont know anyone who prefixes things with :: asides from maybe alloc or std, and space_after_colon=false isnt widely used, but this should probably be looked into

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugPanic, non-idempotency, invalid code, etc.only-with-optionrequires a non-default option value to reproduce

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions