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

Underindentation for chained methods #4199

Closed
zgotsch opened this issue May 24, 2020 · 1 comment
Closed

Underindentation for chained methods #4199

zgotsch opened this issue May 24, 2020 · 1 comment

Comments

@zgotsch
Copy link

zgotsch commented May 24, 2020

I noticed that some of my chained methods are not indented as I would expect. Here is my code after formatting:

let outdated_executables = async {
    let outdated = homebrew::outdated().await.unwrap();
    let executables = join_all(outdated.iter().map(|p| {
        homebrew::executables(&p.package_name, &p.installed_versions.last().unwrap())
    }))
    .await
    .into_iter()
    .flatten()
    .collect::<HashSet<std::ffi::OsString>>();
    return executables;
};

and here is what I expect

let outdated_executables = async {
    let outdated = homebrew::outdated().await.unwrap();
    let executables = join_all(outdated.iter().map(|p| {
        homebrew::executables(&p.package_name, &p.installed_versions.last().unwrap())
    }))
        .await
        .into_iter()
        .flatten()
        .collect::<HashSet<std::ffi::OsString>>();
    return executables;
};

I tried to make a minimal example, which looks like this:

join_all(foo.map(|p| {
    bar(
        // this comment stands in for long arguments
    )
}))
.into_iter();

You can also find it and the original here: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=60b1965f30288344ffff9b9df6678347

Many changes to the example result in fixed indentation, so I'm not sure exactly what is causing the underindentation. Let me know if this is expected behavior and my expectations are misplaced for some reason!

@calebcartwright
Copy link
Member

This is the expected behavior currently @zgotsch. However, we may provide some future enhancements to allow users to configure whether or not the child chain items are indented when the chain parent is multi-lined

This is a duplicate of #3157 though so I'm going to close this one (feel free to track the linked issue).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants