Skip to content

Configurable? Fn brace next line except single line definitions #999

@jwilm

Description

@jwilm

I'm trying to configure braces for fns to appear on the next line except when the function signature fits on a single line. Is this currently possible? Sorry if this is a duplicate; I looked around a bit and couldn't find anything.

Examples

Single line fn

/// Open brace on same line
fn thing_doer() -> Result<Thing, DoError> {
    // ...
}

Multi-line

/// Open brace always comes on next line independent of return and where clause.
fn thing_doer<S>(
    a: &str,
    b: S
) -> Result<Thing, DoError>
    where S: Into<Potato>
{
    // ...
}

Edits

  • Updated multi-line example formatting

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: a feature request (not decided/implemented)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions