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

rustfmt gives up on method chain with closure with very long return type #6076

Closed
jrose-signal opened this issue Feb 16, 2024 · 2 comments
Closed

Comments

@jrose-signal
Copy link

rustfmt refuses to format the following statement (reduced from a real-world example):

fn test() {
    let output: Vec<_> = input
            .into_iter()
            .map(|serialized| -> Result<long_crate::LongCrateTypeName, long_crate::DeserializationFailure> {
                Ok(serialized)
            })
            .map_err(|_| {
                // A comment
                Failure
            })?;
}

The long type names seem to be at fault; shortening either of them results in a successful format. I realize there's not a great way to format that type, but giving up on the entire statement was surprising.

Tested on play.rust-lang.org using the 2024-02-04 07dca48 build of rustfmt.

@ytmimi
Copy link
Contributor

ytmimi commented Feb 16, 2024

Thanks for the report. This is another duplicate of #3863

@ytmimi ytmimi closed this as not planned Won't fix, can't repro, duplicate, stale Feb 16, 2024
@jrose-signal
Copy link
Author

Ah, not specific to types. Thanks!

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