Skip to content

Final return statements versus implicit return #814

Closed
@ketsuban

Description

@ketsuban

Exhibit A

fn i_am_the_walrus(foo: u32) -> u64 {
    ((foo as u64) << 32) + (foo as u64)
}

Exhibit B

fn i_am_the_walrus(foo: u32) -> u64 {
    return ((foo as u64) << 32) + (foo as u64);
}

Given that the Book refers to B as “poor style”, is it within rustfmt's bailiwick (being that it is a tool for resolving stylistic disagreements) to replace it with A?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions