Skip to content

Test formatting of chains containing mixed function calls and method calls #104

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

Closed
dtolnay opened this issue Mar 10, 2025 · 1 comment
Closed

Comments

@dtolnay
Copy link
Owner

dtolnay commented Mar 10, 2025

The use case from rust-lang/rustfmt#3157 (comment). Rustfmt formats as:

fn example() {
    let some_very_very_long_name = |x, y| x + y;
    let x = "1"
        .parse::<i32>()
        .unwrap()
        .as_method(some_very_very_long_name)(2)
    .count_ones();

    println! {"{x}"};
}
@dtolnay
Copy link
Owner Author

dtolnay commented Mar 10, 2025

Looks like prettyplease handles this "correctly". Current output:

fn example() {
    let some_very_very_long_name = |x, y| x + y;
    let x = "1"
        .parse::<i32>()
        .unwrap()
        .as_method(some_very_very_long_name)(2)
        .count_ones();
    println!("{x}");
}

@dtolnay dtolnay closed this as completed Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant