Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

brace_style option not respected on polyadic functions with multiline signatures under "where_single_line = true" #4547

Closed
meiomorphism opened this issue Nov 24, 2020 · 1 comment
Assignees
Labels
only-with-option requires a non-default option value to reproduce poor-formatting

Comments

@meiomorphism
Copy link
Contributor

meiomorphism commented Nov 24, 2020

Input

pub fn function_of_arity_one(
    parameter_one: Option<Option<Option<Option<Option<Option<bool>>>>>>,
) -> Option<bool> {
    None
}

pub fn function_of_arity_two(
    parameter_one: Option<Option<Option<Option<Option<Option<bool>>>>>>,
    parameter_two: Option<Option<Option<Option<Option<Option<bool>>>>>>,
) -> Option<bool> {
    None
}

pub fn function_of_arity_three(a: u8, b: u8, c: u8) -> Option<bool> {
    None
}

Output

The space after the second function's return type is converted to a newline:

pub fn function_of_arity_one(
    parameter_one: Option<Option<Option<Option<Option<Option<bool>>>>>>,
) -> Option<bool> {
    None
}

pub fn function_of_arity_two(
    parameter_one: Option<Option<Option<Option<Option<Option<bool>>>>>>,
    parameter_two: Option<Option<Option<Option<Option<Option<bool>>>>>>,
) -> Option<bool>
{
    None
}

pub fn function_of_arity_three(a: u8, b: u8, c: u8) -> Option<bool> {
    None
}

Expected output

Identical to input.

Meta

rustfmt 1.4.27-nightly (580d826 2020-11-16), installed via rustup, and invoked as cargo +nightly fmt -- ./test.rs.

rustfmt.toml contained no uncommented lines except where_single_line = true.

@calebcartwright
Copy link
Member

Agreed. In cases where the fn signature has to be formatted across multiple lines then a present where clause would need to be formatted in the multiline form even if when where_single_line is true, but that rule shouldn't be applied in the absence of a where clause

@calebcartwright calebcartwright added the only-with-option requires a non-default option value to reproduce label Nov 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
only-with-option requires a non-default option value to reproduce poor-formatting
Projects
None yet
Development

No branches or pull requests

3 participants